From a6fcf0eb7b31e93904b9c14f23404d682ce99c4d Mon Sep 17 00:00:00 2001 From: nmemmert Date: Fri, 16 Jan 2026 08:01:45 -0500 Subject: [PATCH] fix: add page reload back to apply theme changes --- src/app/layout.tsx | 6 +++++- src/components/SettingsPage.tsx | 21 ++++----------------- 2 files changed, 9 insertions(+), 18 deletions(-) diff --git a/src/app/layout.tsx b/src/app/layout.tsx index efb7789..443c5e4 100644 --- a/src/app/layout.tsx +++ b/src/app/layout.tsx @@ -62,7 +62,11 @@ export default function RootLayout({ html.classList.remove('dark'); } else if (theme === 'system') { const isDark = window.matchMedia('(prefers-color-scheme: dark)').matches; - if (isDark) html.classList.add('dark'); + if (isDark) { + html.classList.add('dark'); + } else { + html.classList.remove('dark'); + } } })(); ` diff --git a/src/components/SettingsPage.tsx b/src/components/SettingsPage.tsx index a7ad8bf..3f11a3c 100644 --- a/src/components/SettingsPage.tsx +++ b/src/components/SettingsPage.tsx @@ -28,23 +28,10 @@ export default function SettingsPage({ userEmail }: SettingsPageProps) { setCurrentTheme(newTheme); localStorage.setItem('theme-mode', newTheme); - const html = document.documentElement; - - if (newTheme === 'dark') { - html.classList.add('dark'); - toast.success('🌙 Dark theme'); - } else if (newTheme === 'light') { - html.classList.remove('dark'); - toast.success('☀️ Light theme'); - } else if (newTheme === 'system') { - const prefersDark = window.matchMedia('(prefers-color-scheme: dark)').matches; - if (prefersDark) { - html.classList.add('dark'); - } else { - html.classList.remove('dark'); - } - toast.success('🔄 System'); - } + toast.success('🔄 Applying theme...'); + setTimeout(() => { + window.location.reload(); + }, 800); }; return (