Refresh the active evidence band live and drop its duplicate switch count

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 <noreply@anthropic.com>
This commit is contained in:
2026-06-01 19:23:49 -04:00
parent d95aed0111
commit 1c81eb1b50
2 changed files with 11 additions and 4 deletions
-1
View File
@@ -98,7 +98,6 @@ input:focus { outline: 0; border-color: var(--accent); }
display: flex; justify-content: space-between; padding: 2px 0; display: flex; justify-content: space-between; padding: 2px 0;
font-family: ui-monospace, monospace; font-variant-numeric: tabular-nums; font-family: ui-monospace, monospace; font-variant-numeric: tabular-nums;
} }
.switches { font-size: 12px; color: var(--ink-dim); margin-top: 8px; }
/* Review summary band */ /* Review summary band */
.summary { font-size: 14px; } .summary { font-size: 14px; }
+11 -3
View File
@@ -35,7 +35,7 @@ function setStateAttr(state) {
} }
function evidenceBlock(ev) { function evidenceBlock(ev) {
if (!ev) return ''; if (!ev) return `<div class="band evidence" id="evidence" hidden></div>`;
const health = ev.available const health = ev.available
? `<span class="health-ok">tracking</span>` ? `<span class="health-ok">tracking</span>`
: `<span class="health-bad">evidence unavailable: ${ev.reason || 'unknown'}</span>`; : `<span class="health-bad">evidence unavailable: ${ev.reason || 'unknown'}</span>`;
@@ -43,13 +43,20 @@ function evidenceBlock(ev) {
? `${ev.current.class || '?'} · ${ev.current.title || ''}` : '—'; ? `${ev.current.class || '?'} · ${ev.current.title || ''}` : '—';
const rows = (ev.buckets || []).map(b => const rows = (ev.buckets || []).map(b =>
`<li><span>${(b.class || '?')} · ${b.title || ''}</span><span>${fmt(b.seconds)}</span></li>`).join(''); `<li><span>${(b.class || '?')} · ${b.title || ''}</span><span>${fmt(b.seconds)}</span></li>`).join('');
return `<div class="band evidence"> return `<div class="band evidence" id="evidence">
<div class="now">now ${now} &nbsp; ${health}</div> <div class="now">now ${now} &nbsp; ${health}</div>
<ul class="buckets">${rows}</ul> <ul class="buckets">${rows}</ul>
<div class="switches">context switches: ${ev.switch_count || 0}</div>
</div>`; </div>`;
} }
// 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: // reviewSummary renders a presentational recap from already-available state:
// the commitment plus the per-window evidence buckets. No new backend data. // the commitment plus the per-window evidence buckets. No new backend data.
function reviewSummary(ev) { function reviewSummary(ev) {
@@ -213,6 +220,7 @@ function render(state) {
} }
if (rs === 'active' && renderedState === 'active') { if (rs === 'active' && renderedState === 'active') {
updateActiveDrift(state); updateActiveDrift(state);
updateActiveEvidence(state);
return; return;
} }
if (countdownTimer) { clearInterval(countdownTimer); countdownTimer = null; } if (countdownTimer) { clearInterval(countdownTimer); countdownTimer = null; }