From 1c81eb1b50d4133f779637d14ce62974722bd9c7 Mon Sep 17 00:00:00 2001 From: Felix Martin Date: Mon, 1 Jun 2026 19:23:49 -0400 Subject: [PATCH] Refresh the active evidence band live and drop its duplicate switch count MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The active view's fast-path repainted only the status band, so the "now" window, per-window buckets, and their times froze at the moment the active screen first rendered — only the status-band switch count and the countdown kept moving. Give the evidence band a stable id and repaint it every tick via updateActiveEvidence, mirroring updateActiveDrift. The evidence band's own "context switches" readout duplicated the live count in the status band, so remove it (and its now-dead .switches CSS rule). Co-Authored-By: Claude Opus 4.8 --- internal/web/static/app.css | 1 - internal/web/static/app.js | 14 +++++++++++--- 2 files changed, 11 insertions(+), 4 deletions(-) diff --git a/internal/web/static/app.css b/internal/web/static/app.css index ea4bf6e..12bc281 100644 --- a/internal/web/static/app.css +++ b/internal/web/static/app.css @@ -98,7 +98,6 @@ input:focus { outline: 0; border-color: var(--accent); } display: flex; justify-content: space-between; padding: 2px 0; font-family: ui-monospace, monospace; font-variant-numeric: tabular-nums; } -.switches { font-size: 12px; color: var(--ink-dim); margin-top: 8px; } /* Review summary band */ .summary { font-size: 14px; } diff --git a/internal/web/static/app.js b/internal/web/static/app.js index fe6cae3..98adf5a 100644 --- a/internal/web/static/app.js +++ b/internal/web/static/app.js @@ -35,7 +35,7 @@ function setStateAttr(state) { } function evidenceBlock(ev) { - if (!ev) return ''; + if (!ev) return ``; const health = ev.available ? `tracking` : `evidence unavailable: ${ev.reason || 'unknown'}`; @@ -43,13 +43,20 @@ function evidenceBlock(ev) { ? `${ev.current.class || '?'} · ${ev.current.title || ''}` : '—'; const rows = (ev.buckets || []).map(b => `
  • ${(b.class || '?')} · ${b.title || ''}${fmt(b.seconds)}
  • `).join(''); - return `
    + return `
    now ${now}   ${health}
      ${rows}
    -
    context switches: ${ev.switch_count || 0}
    `; } +// updateActiveEvidence repaints the live evidence band (current window, per-window +// buckets, switch count) on every active tick. The band carries no event listeners, +// so swapping outerHTML wholesale is safe and keeps a single render source. +function updateActiveEvidence(state) { + const el = document.getElementById('evidence'); + if (el) el.outerHTML = evidenceBlock(state.evidence); +} + // reviewSummary renders a presentational recap from already-available state: // the commitment plus the per-window evidence buckets. No new backend data. function reviewSummary(ev) { @@ -213,6 +220,7 @@ function render(state) { } if (rs === 'active' && renderedState === 'active') { updateActiveDrift(state); + updateActiveEvidence(state); return; } if (countdownTimer) { clearInterval(countdownTimer); countdownTimer = null; }