From 2a25c912a72ba1ecae9a5eccc1ad0b8a45492a8f Mon Sep 17 00:00:00 2001 From: temitope adesoji Date: Thu, 13 Oct 2022 10:52:45 +0100 Subject: [PATCH] fix dark theme toggle flash --- packages/website/src/components/DarkModeToggle.tsx | 4 +--- packages/website/src/layouts/BaseHead.astro | 2 +- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/packages/website/src/components/DarkModeToggle.tsx b/packages/website/src/components/DarkModeToggle.tsx index f54977c25..46ed1dc04 100644 --- a/packages/website/src/components/DarkModeToggle.tsx +++ b/packages/website/src/components/DarkModeToggle.tsx @@ -7,9 +7,7 @@ export function DarkModeToggle() { const [enabled, setEnabled] = useState(false); useEffect(() => { - const isDarkModeEnabled = - localStorage.theme === 'dark' || - document.documentElement.classList.contains('dark'); + const isDarkModeEnabled = document.documentElement.classList.contains('dark'); setEnabled(isDarkModeEnabled); }, []); diff --git a/packages/website/src/layouts/BaseHead.astro b/packages/website/src/layouts/BaseHead.astro index a29bd4f73..a6340f27d 100644 --- a/packages/website/src/layouts/BaseHead.astro +++ b/packages/website/src/layouts/BaseHead.astro @@ -22,7 +22,7 @@ import.meta.env.PROD && ( gtag('config', 'G-DJRQC2FR73'); )} -