diff --git a/web/src/components/ThemeToggle.tsx b/web/src/components/ThemeToggle.tsx index 4a2dd24..d6bd9e4 100644 --- a/web/src/components/ThemeToggle.tsx +++ b/web/src/components/ThemeToggle.tsx @@ -12,6 +12,11 @@ export function ThemeToggle() { useEffect(() => { const stored = localStorage.getItem("sl-theme") as Theme | null; + // localStorage is unavailable during SSR, so the stored theme can only be + // read post-mount. ThemeScript already applies the `dark` class before + // hydration (no page FOUC); only the toggle icon corrects on mount. The + // rule is a false positive for this hydration-from-localStorage read. + // eslint-disable-next-line react-hooks/set-state-in-effect if (stored) setTheme(stored); }, []);