Radish alpha
r
rad:z4V1sjrXqjvFdnCUbxPFqd5p4DtH5
Radicle web interface
Radicle
Git
Further improve on handling disabled `localStorage`
Merged did:key:z6MkkfM3...sVz5 opened 0 years ago

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.

check check-visual check-unit-test check-http-client-unit-test check-radicle-httpd check-e2e check-build check-http

👉 Preview 👉 Workflow runs 👉 Branch on GitHub

2 files changed +2 -2 2270e618 14f3c6f6
modified src/lib/appearance.ts
@@ -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>(
modified src/lib/localStore.ts
@@ -92,7 +92,7 @@ export default function storedWritable<
   */
  function clear() {
    w.set(initialValue);
-
    localStorage.removeItem(key);
+
    if (!disableLocalStorage) localStorage.removeItem(key);
  }

  return {