add toggle fix and possible log out issue
This commit is contained in:
@@ -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;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user