From b1c1b32d47dc8ec0b16e2192977a327a10a94aa3 Mon Sep 17 00:00:00 2001 From: Jenny Ferries Date: Thu, 30 Jul 2026 17:54:30 -0700 Subject: [PATCH] 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 --- extensions/daily-focus-board/board-core.mjs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/extensions/daily-focus-board/board-core.mjs b/extensions/daily-focus-board/board-core.mjs index afc85492..0d414bc9 100644 --- a/extensions/daily-focus-board/board-core.mjs +++ b/extensions/daily-focus-board/board-core.mjs @@ -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;