From ddeaf6d7fe6228f613b50f2b15090beaf60ce35c Mon Sep 17 00:00:00 2001 From: Claas Augner <495429+caugner@users.noreply.github.com> Date: Mon, 23 Sep 2024 11:36:34 +0200 Subject: [PATCH] Apply suggestions from code review Co-authored-by: Leo McArdle --- .../ui/organisms/article-actions/language-menu/index.tsx | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/client/src/ui/organisms/article-actions/language-menu/index.tsx b/client/src/ui/organisms/article-actions/language-menu/index.tsx index dd13d4c70edd..103c1ae47076 100644 --- a/client/src/ui/organisms/article-actions/language-menu/index.tsx +++ b/client/src/ui/organisms/article-actions/language-menu/index.tsx @@ -133,8 +133,8 @@ function LocaleRedirectSetting() { const [value, setValue] = useState(false); useEffect(() => { - setValue(!!getCookieValue(PREFERRED_LOCALE_COOKIE_NAME)); - }, [setValue]); + setValue(Boolean(getCookieValue(PREFERRED_LOCALE_COOKIE_NAME))); + }, []); function toggle(event) { const newValue = event.target.checked; @@ -147,7 +147,7 @@ function LocaleRedirectSetting() { } else { deleteCookie(PREFERRED_LOCALE_COOKIE_NAME); } - setValue(event.target.checked); + setValue(newValue); gleanClick(`${LANGUAGE_REDIRECT}: ${locale} -> ${Number(newValue)}`); }