mirror of
https://seed.radicle.dev/rad:z4V1sjrXqjvFdnCUbxPFqd5p4DtH5.git
synced 2026-10-30 16:50:47 +08:00
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:
@@ -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>(
|
||||
|
||||
@@ -92,7 +92,7 @@ export default function storedWritable<
|
||||
*/
|
||||
function clear() {
|
||||
w.set(initialValue);
|
||||
localStorage.removeItem(key);
|
||||
if (!disableLocalStorage) localStorage.removeItem(key);
|
||||
}
|
||||
|
||||
return {
|
||||
|
||||
Reference in New Issue
Block a user