Skip to content

Commit

Permalink
fix: validate theme from storage
Browse files Browse the repository at this point in the history
  • Loading branch information
reneaaron committed Jul 10, 2024
1 parent 894c2c3 commit 45f79f2
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion frontend/src/components/ui/theme-provider.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,8 @@ export function ThemeProvider({
...props
}: ThemeProviderProps) {
const [theme, setTheme] = useState<Theme>(() => {
return (localStorage.getItem(storageKey) as Theme) || defaultTheme;
const themeFromStorage = localStorage.getItem(storageKey) as Theme;
return Themes.includes(themeFromStorage) ? themeFromStorage : defaultTheme;
});

const [darkMode, setDarkMode] = useState<DarkMode>(() => {
Expand Down

0 comments on commit 45f79f2

Please sign in to comment.