Skip to content

Commit

Permalink
fix: validate theme from storage (#244)
Browse files Browse the repository at this point in the history
  • Loading branch information
reneaaron authored Jul 10, 2024
1 parent 3b8378e commit 5a7b68a
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 5a7b68a

Please sign in to comment.