add toggle fix and possible log out issue

This commit is contained in:
JCEEE
2026-09-14 12:09:44 +01:00
parent 70a38ee95b
commit 158a60f30c
8 changed files with 120 additions and 49 deletions
+11 -1
View File
@@ -15,7 +15,17 @@ export function readShortcut(): Shortcut | null {
if (typeof localStorage === 'undefined') return null;
try {
const raw = localStorage.getItem(KEY);
return raw ? (JSON.parse(raw) as Shortcut) : null;
if (!raw) return null;
const s = JSON.parse(raw) as Shortcut;
// Self-heal the old poisoned entry: a write that fell back to
// page.params.fam while page.data.fam was null stored the PB id as
// both slug and name ({famSlug: id, famName: id}). A real slug is
// never identical to the display name AND a 15-char PB id.
if (s && s.famSlug === s.famName && /^[a-z0-9]{15}$/.test(s.famSlug || '')) {
localStorage.removeItem(KEY);
return null;
}
return s;
} catch {
return null;
}