Skip to content

Commit

Permalink
Temp fix entire page disapearing when theme buttons double-clicked
Browse files Browse the repository at this point in the history
  • Loading branch information
Owen-Morgan825 committed Jan 15, 2025
1 parent 6320a8e commit 0f349e1
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions src/components/ThemeProvider.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,6 @@ export function ThemeProvider({

useEffect(() => {
const root = window.document.documentElement;

root.classList.remove('light', 'dark');

if (theme === 'system') {
Expand All @@ -58,8 +57,13 @@ export function ThemeProvider({
root.classList.add(systemTheme);
return;
}
setResolvedTheme(theme);
root.classList.add(theme);

if(theme !== '') {
setResolvedTheme(theme);
root.classList.add(theme);
}


}, [theme]);

const value = {
Expand Down

0 comments on commit 0f349e1

Please sign in to comment.