From 01f0c707dcb4a91272051657efd0db32caff99b0 Mon Sep 17 00:00:00 2001 From: Anton Tranelis <31516529+antontranelis@users.noreply.github.com> Date: Thu, 19 Jun 2025 13:32:19 +0200 Subject: [PATCH] fix theme hook --- lib/src/Components/AppShell/hooks/useTheme.tsx | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/lib/src/Components/AppShell/hooks/useTheme.tsx b/lib/src/Components/AppShell/hooks/useTheme.tsx index 367d8fd3..cd85649b 100644 --- a/lib/src/Components/AppShell/hooks/useTheme.tsx +++ b/lib/src/Components/AppShell/hooks/useTheme.tsx @@ -5,8 +5,11 @@ export const useTheme = (defaultTheme = 'default') => { const savedTheme = localStorage.getItem('theme') const initialTheme = savedTheme ? (JSON.parse(savedTheme) as string) : defaultTheme if (initialTheme !== 'default') { - document.documentElement.setAttribute('data-theme', defaultTheme) + document.documentElement.setAttribute('data-theme', initialTheme) localStorage.setItem('theme', JSON.stringify(initialTheme)) + } else { + document.documentElement.removeAttribute('data-theme') + localStorage.removeItem('theme') } }, [defaultTheme]) }