From 94edeba10f542f036870ad9cf11c004216df1aa4 Mon Sep 17 00:00:00 2001 From: alexsparkes Date: Wed, 4 Feb 2026 19:52:26 +0000 Subject: [PATCH] fix(Radio): update state management for language selection and local storage --- src/components/Form/Settings/Radio/Radio.jsx | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/src/components/Form/Settings/Radio/Radio.jsx b/src/components/Form/Settings/Radio/Radio.jsx index cfb6086a..87f26a78 100644 --- a/src/components/Form/Settings/Radio/Radio.jsx +++ b/src/components/Form/Settings/Radio/Radio.jsx @@ -7,8 +7,10 @@ import EventBus from 'utils/eventbus'; import './Radio.scss'; const Radio = memo((props) => { - const { changeLanguage } = useTranslation(); - const [value, setValue] = useState(localStorage.getItem(props.name)); + const { changeLanguage, language } = useTranslation(); + const [localValue, setLocalValue] = useState(localStorage.getItem(props.name)); + + const value = props.name === 'language' ? language : localValue; const handleChange = useCallback( async (newValue) => { @@ -18,7 +20,7 @@ const Radio = memo((props) => { if (props.name === 'language') { changeLanguage(newValue); - setValue(newValue); + setLocalValue(newValue); variables.stats.postEvent('setting', `${props.name} from ${value} to ${newValue}`); @@ -31,7 +33,7 @@ const Radio = memo((props) => { } localStorage.setItem(props.name, newValue); - setValue(newValue); + setLocalValue(newValue); if (props.onChange) { props.onChange(newValue);