Upload theme.ts
Browse files- 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)
|
| 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;
|