From 0b46f0b1e43fcc56733db1181d869033a72741a6 Mon Sep 17 00:00:00 2001 From: npeter83 Date: Fri, 12 Jun 2026 18:07:31 +0200 Subject: [PATCH] fix(notifications): don't resurrect stale toasts on reload MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Persisted notifications were restored with their saved 'dismissed' state, so any that were still active when the page closed came back as active toasts — but their auto-dismiss timers aren't re-armed on load, leaving them stuck on screen forever (a burst of errors could pile up dozens). Mark restored entries as dismissed on load: they stay in the bell history but no longer reappear as live toasts. The toast surface is session-transient; history persists. --- frontend/src/lib/notifications.ts | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/frontend/src/lib/notifications.ts b/frontend/src/lib/notifications.ts index bf8dd27..530ce68 100644 --- a/frontend/src/lib/notifications.ts +++ b/frontend/src/lib/notifications.ts @@ -118,7 +118,11 @@ function load(): Notification[] { try { const raw = JSON.parse(localStorage.getItem(HISTORY_KEY) || "[]"); if (!Array.isArray(raw)) return []; - return raw.map((n) => ({ ...n, action: undefined }) as Notification); + // Restored entries are history only. Mark them dismissed so they don't + // resurrect as active toasts on reload — their auto-dismiss timers aren't + // re-armed across a reload, so otherwise they'd stick forever. Also drop the + // live `action` callback, which can't survive serialization. + return raw.map((n) => ({ ...n, action: undefined, dismissed: true }) as Notification); } catch { return []; }