Repository navigation
fix(dashboard): refill the open Dashboard page instead of reloading it - #19878
Conversation
Design Review (Opus 5.5) — ✅ PASSDesign-level review of Design-Verdict: PASS Not yet checked on a real gateway: a builtin Dashboard tab should keep its iframe, with no reload or flicker, while values change at the same page version. [DESIGN-REVIEWED] c8a999c Description read[DESCRIPTION-READ] a7df2793792202a887146499f11770d9c2e8fcad262b9ec6148ff7a01b1bb4ab That sha256 names everything this verdict read: the PR description, plus the 1 evidence file(s) the workflow collected from it and handed this review. It covers that evidence because the media strip replaces every attachment URL with the same placeholder, so an edit swapping one attachment for another would leave the description's captured text identical while what this review judged changed. Recompute it with |
First Principles Review (Opus 5.5) — ✅ PASSPremise-level review of First-Principles-Verdict: PASS No one has watched a real Dashboard tab on a live gateway yet. Confirm the conductor-panel page redraws in place without flickering before merge. What this change shipsInventory (7 items) — 7 justifiedIntent: stop the Dashboard tab reloading (flickering) each time its data refreshes. This is a FIX for #19870, with a test that fails on base.
[FIRST-PRINCIPLES-REVIEWED] c8a999c Description read[DESCRIPTION-READ] ae409775615aeb953b71974911a69247dbde3d4cf366be36c3526390fb6d9d78 That sha256 names the PR description this verdict read. Recompute it with |
UX Review (Opus 5.5) — ✅ PASSUX-level review of UX-Verdict: PASS Check one live Dashboard tab across several refreshes: the numbers should update with no blank flash, and the scroll position should stay put. The author did not test this on a real gateway. [UX-REVIEWED] c8a999c Description read[DESCRIPTION-READ] ced13725c16746863e3ba19beea07a525633f39bb8a05ea20aac055a4b8e376b That sha256 names everything this verdict read: the PR description, plus the 3 evidence file(s) the workflow collected from it and handed this review. It covers that evidence because the media strip replaces every attachment URL with the same placeholder, so an edit swapping one attachment for another would leave the description's captured text identical while what this review judged changed. Recompute it with |
Opus 5.5 Review — ✅ no blocking findingsReviewed Verdict parsed from the review's SHA-scoped output markers for commit False positive or not applicable? A repository writer can comment: |
GPT 6.1 Review — ✅ no blocking findingsGPT 6.1 completed its review of This comment is updated in place on each push. Review detailsNo findings. False positive or not applicable? A repository writer can comment: |
Problem / Motivation
Goal: The Dashboard tab updates its numbers in place, without reloading the whole page each time its data refreshes.
The user's live report: every time the Dashboard tab's data refreshes, the whole page reloads, so the dashboard flickers. Charts, scroll position and animations reset on every read.
Why it matters
Every crewmate's Dashboard tab refreshes on each crewmate write, each fold advance and the 60 s fallback read. So a page someone is reading flashes blank and redraws several times a minute while work moves, which is exactly when they are watching it.
Not a goal
window.kirocrew.subscribefor agent-written package pages. That is feat(dashboard): host an agent-written dashboard page and let it subscribe (#19060) #19335; this PR does not touch it and does not depend on it.What changed (motivation → approach → change)
Symptom → cause. A refetch at the same instance version brings the same page with new values baked into
rendered_html. The frame swappedgoodto that html, which changed the srcdoc.useSandboxDocthen minted a new URL, and the iframe loaded a whole new document. The composed page already has a refill listener forkirocrew-dashboard:data(indashboard_frame._BOOTSTRAP_JS), but the host never posted to it.Fix (
website/src/pages/members/CrewDynamicDashboard.tsx). The document is now keyed on the page (instance version, template id, template version) and the theme, not on the values. On a same-page read, the host reads the values out of the new html's data island (DOMParser+getElementById+JSON.parse, no regex over HTML). It posts them to the frame's owncontentWindowas the refill message the page already takes. Probation, readiness and height are unchanged.Never stale. A page whose own script never redraws on a refill would keep its old numbers. So the frame asks the page itself. A small probe in
src/kiro_crew/dashboard_frame.py(the composed document), after the bootstrap and before the page, notes whether the page listens formessageorkirocrew-dashboardonwindow. The ready beacon now carriesrefill: true|false. The host refills only a document that saidrefill: true. Every other document (no beacon yet,false, or no readable island) gets a new document exactly as before. The band script registers through the prototype, so the host's own listener is not counted. When a refill-capable document beacons, the newest values are posted once more, so a read that landed while it loaded is not lost.Why this signal. The beacon is the one message the page already sends, and only after its scripts ran cleanly. Reading listeners as they are registered tells the host what the page actually does; a template-id allowlist would miss operator pages that do redraw. A wrong NO costs a reload, never a stale page. All 12 builtins and the user's live operator page (conductor-panel) beacon
refill: truein a jsdom run.Security. The post goes only to
frameRef's owncontentWindow, with'*'because the sandboxed frame's origin is opaque. It carries only the read the gateway already composed into that page. No new HTML sink:DOMParserbuilds an inert document and only the island's text is read. The probe is not a trust boundary: a page that claims refills it does not handle only keeps its own numbers stale.Backwards compatibility
Compatible: the beacon gains one field that older hosts ignore, and a document that does not report
refill: truegets the same reload as today.Removes nothing: no route, key, field or behaviour is removed; the reload path stays as the fallback.
Tests
website/src/test/CrewDynamicDashboardRefill.test.tsx(new). It was red on main before the fix:postMessagewas called 0 times.{type: 'kirocrew-dashboard:data', read}with the new values.refill: falsestill gets a new mint with the new values.refillclaim from any other window is ignored.islandReadround-trips HTML-escaped JSON and returns null on no island, broken JSON, or a non-object.website/src/test/CrewDynamicDashboard.test.tsx: the "fresher VALUES for the same page version" pin now expects a refill post and no second mint.test/test_dashboard_frame.py: the probe sits between the bootstrap and the page, the band does not count as the page's listener, and the beacon reports the flag.Fails before the fix (main @ cf9ee6b):
Manual verification
dashboard_frame.compose, then ran each in jsdom with scripts on. All 12 builtins and the staged conductor-panel operator page beacon{"type":"kirocrew-dashboard:ready","refill":true}, with no init errors. The no-listener page beaconsrefill: false.Screenshots / video
Why no screenshot: Nothing on screen changes layout or styling; the change is that the frame stops reloading, which the tests above pin by mint count and iframe identity.
Related Issues
Closes #19870
Pattern harvest
Rule candidate: review-prompt
Pattern: a memo that builds a document or URL from data, keyed on the data rather than on the document's identity, so every data change remounts it.
Checklist
feat|fix|docs|style|refactor|perf|test|chore|ci|build|revert: ...)