From 06477afb813158c0cf7862b58813b64bf9748259 Mon Sep 17 00:00:00 2001 From: Madhura68 Date: Sun, 10 May 2026 12:58:04 +0200 Subject: [PATCH] chore(PBI-76): remove unused readLocalStoragePref helper No consumers left after migrating sprint-backlog, pbi-list, story-panel, jobs-column, and debug-store to user-settings. Co-Authored-By: Claude Opus 4.7 (1M context) --- lib/use-local-storage-pref.ts | 22 ---------------------- 1 file changed, 22 deletions(-) delete mode 100644 lib/use-local-storage-pref.ts diff --git a/lib/use-local-storage-pref.ts b/lib/use-local-storage-pref.ts deleted file mode 100644 index aa28c89..0000000 --- a/lib/use-local-storage-pref.ts +++ /dev/null @@ -1,22 +0,0 @@ -/** - * SSR-safe synchronous read of a localStorage value with a typed parser. - * - * Use inside `useState(() => readLocalStoragePref(...))` so the first render - * already has the persisted value — no useEffect-driven re-render flicker. - * - * On the server `window` is undefined → returns `fallback`. On the client the - * raw value is parsed; if the parser returns `null` the fallback is used. - * Hydration mismatches between server-rendered HTML (default) and the - * client-rendered tree (persisted) are accepted: React adapts the DOM in the - * same hydration pass without a visible flicker for matching values. - */ -export function readLocalStoragePref( - key: string, - parse: (raw: string) => T | null, - fallback: T, -): T { - if (typeof window === 'undefined') return fallback - const raw = window.localStorage.getItem(key) - if (raw === null) return fallback - return parse(raw) ?? fallback -}