aproli90 commited on
Commit
d4e518e
·
verified ·
1 Parent(s): f48d08f

Upload theme.ts

Browse files
Files changed (1) hide show
  1. app/lib/stores/theme.ts +2 -2
app/lib/stores/theme.ts CHANGED
@@ -15,10 +15,10 @@ export const themeStore = atom<Theme>(initStore());
15
 
16
  function initStore() {
17
  if (!import.meta.env.SSR) {
18
- const persistedTheme = localStorage.getItem(kTheme) as Theme | undefined;
19
  const themeAttribute = document.querySelector('html')?.getAttribute('data-theme');
20
 
21
- return persistedTheme ?? (themeAttribute as Theme) ?? DEFAULT_THEME;
22
  }
23
 
24
  return DEFAULT_THEME;
 
15
 
16
  function initStore() {
17
  if (!import.meta.env.SSR) {
18
+ const persistedTheme = localStorage.getItem(kTheme) || DEFAULT_THEME as Theme | undefined;
19
  const themeAttribute = document.querySelector('html')?.getAttribute('data-theme');
20
 
21
+ return persistedTheme ?? (themeAttribute as Theme);
22
  }
23
 
24
  return DEFAULT_THEME;