From 41071f8a8986d76e9516c76ea5a7ed473108f002 Mon Sep 17 00:00:00 2001 From: GitHub Copilot Date: Thu, 26 Feb 2026 20:33:44 +0000 Subject: [PATCH] fix: sync bell state on all dashboard tiles when tab regains focus MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The orange bell outline on tiles could get stuck because: 1. The terminal tab clears its bell localStorage entry on focus/keypress, but the 'storage' event only fires across tabs — the dashboard in the same browser never sees the removal. 2. The only way to clear the bell class was to click the tile to open it (openTile → clearBellState). Simply switching back to the dashboard tab never re-checked localStorage. Now onDashboardFocusChanged() calls syncAllBellStates() which re-reads localStorage for every tile and toggles the bell class accordingly, clearing stale orange outlines as soon as the dashboard becomes visible. --- webterm/server.go | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/webterm/server.go b/webterm/server.go index 392b093..92afc49 100644 --- a/webterm/server.go +++ b/webterm/server.go @@ -1240,6 +1240,14 @@ func (s *LocalServer) handleRoot(w http.ResponseWriter, r *http.Request) { updateDashboardTitle(); } + function syncAllBellStates() { + for (const tile of tiles) { + if (tile && tile.slug) { + applyBellState(tile.slug); + } + } + } + function clearBellState(slug) { if (!slug) return; localStorage.removeItem(bellStorageKey(slug)); @@ -1490,6 +1498,11 @@ func (s *LocalServer) handleRoot(w http.ResponseWriter, r *http.Request) { function onDashboardFocusChanged() { if (dashboardCanRequestScreenshots()) { + // Re-check bell state for all tiles — the terminal tab may have + // cleared its localStorage entry while we were hidden, and the + // storage event only fires across tabs, not within the same tab. + syncAllBellStates(); + // If the dashboard was hidden for more than a few seconds, // clear ETags and refresh all tiles so the user sees current state. const away = dashboardHiddenAt ? (Date.now() - dashboardHiddenAt) : 0;