From ac9d347a26fc4df55dbb04ddf6d6d5ec89889543 Mon Sep 17 00:00:00 2001 From: Marcos Rios Date: Thu, 22 Feb 2024 23:55:07 -0300 Subject: [PATCH] Remove nonsense ref --- src/pages/Settings.tsx | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/src/pages/Settings.tsx b/src/pages/Settings.tsx index d4ee5292..d56e4815 100644 --- a/src/pages/Settings.tsx +++ b/src/pages/Settings.tsx @@ -105,8 +105,6 @@ export function SettingsPage() { const setTheme = useThemeStore((s) => s.setTheme); const previewTheme = usePreviewThemeStore((s) => s.previewTheme) ?? "default"; const setPreviewTheme = usePreviewThemeStore((s) => s.setPreviewTheme); - const activeThemeRef = useRef(activeTheme); - activeThemeRef.current = activeTheme; const appLanguage = useLanguageStore((s) => s.language); const setAppLanguage = useLanguageStore((s) => s.setLanguage); @@ -147,11 +145,10 @@ export function SettingsPage() { enableThumbnails, ); + // Reset the preview theme when the settings page is unmounted useEffect( () => () => { - setPreviewTheme( - activeThemeRef.current === "default" ? null : activeThemeRef.current, - ); + setPreviewTheme(null); }, [setPreviewTheme], );