daily-focus-board: filter malformed momentum/brain entries in normalize()

A state file with a non-string txt (e.g. {"txt":1}) previously loaded, then esc(n.txt) in the canvas threw (numbers have no .replace) and the whole board failed to render. Filter day/brain entries to require a string txt, mirroring the existing task-notes filter. Verified with a headless regression test (45/45).

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

Copilot-Session: fd1eae93-cc9f-4777-812c-a2a9872e1c2b
This commit is contained in:
Jenny Ferries
2026-07-30 17:54:30 -07:00
parent a3e55ed11f
commit b1c1b32d47
+2 -2
View File
@@ -98,8 +98,8 @@ export function normalize(doc) {
// (e.g. reading p.t["toString"] returning Object.prototype.toString).
p.counters = Object.assign(Object.create(null), p.counters && typeof p.counters === "object" ? p.counters : {});
p.t = Object.assign(Object.create(null), p.t && typeof p.t === "object" ? p.t : {});
p.day = Array.isArray(p.day) ? p.day : [];
p.brain = Array.isArray(p.brain) ? p.brain : [];
p.day = Array.isArray(p.day) ? p.day.filter(n => n && typeof n.txt === "string") : [];
p.brain = Array.isArray(p.brain) ? p.brain.filter(n => n && typeof n.txt === "string") : [];
p.focus = validId(p.focus) ? p.focus : null;
p.rm = !!p.rm;