Further improve on handling disabled localStorage

Based on the work done in commit
`a73c5490b160435a0ef5408b54185c9f698cb73f` there are a few places that
make the app not load in case dom storage aka localStorage is disabled.
This commit is contained in:
Sebastian Martinez
2025-05-05 09:54:08 +02:00
parent 2270e61865
commit 14f3c6f63b
2 changed files with 2 additions and 2 deletions
+1 -1
View File
@@ -7,7 +7,7 @@ type Theme = z.infer<typeof themeSchema>;
export const followSystemTheme = storedWritable<boolean | undefined>(
"followSystemTheme",
boolean(),
!localStorage.getItem("theme"),
!localStorage?.getItem("theme"),
!window.localStorage,
);
export const theme = storedWritable<Theme>(
+1 -1
View File
@@ -92,7 +92,7 @@ export default function storedWritable<
*/
function clear() {
w.set(initialValue);
localStorage.removeItem(key);
if (!disableLocalStorage) localStorage.removeItem(key);
}
return {