Dashboard UX: preserve Stats tab selection across session switches #77
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Background
When the user switches the active session while viewing the Stats tab,
handleActiveSessionChangeinapp.jsunconditionally clearsstatsActiveSessionId, hides the stats section, and drops the user back to the Thoughts view. The user must re-click the Stats tab to see the new session's stats.Source: PR5 multi-agent code review (Concurrency dimension)
File:
crates/cognix-server/assets/app.js—handleActiveSessionChangeBranch:
phase-8/dashboard-ui-pr5-statsMotivation
Switching sessions while inspecting any tab is a frequent flow. The Thoughts tab persists across switches (the click handler repaints with the new session), but the Stats tab does not. The asymmetry is undocumented and reads as a UI bug to anyone watching their chosen tab vanish.
Why deferred from PR5
The change requires a product decision: should Stats persist symmetrically with Thoughts (preferred, matches user expectation), or should it remain scoped to the click-arm flow (the current invalidation model, which guarantees stale renders from session A cannot repaint into session B's view). The latter is the safer default; the former is the better UX. Picking between them is out of scope for a tech-debt PR.
Proposed work
handleActiveSessionChangeto setstatsActiveSessionId = newSession, callinvalidateStatsRender(), thenrunStatsRender('all')plusstartStatsPolling()whenstatsPanelVisible. Verify the stale-render guard still holds across the transition.handleActiveSessionChangeexplaining the intentional drop-to-thoughts, and add an E2E test asserting the Stats tab hides on session switch.Acceptance
e2e/dashboard/stats.spec.tscovers the chosen behavior.test_pr5_*intransport/ui/tests/assets.rs).References
crates/cognix-server/assets/app.js::handleActiveSessionChange