Repository navigation
Description
Problem
While fixing #827 in #828, a missed props.mode dependency exposed a structural problem: ChatView survives section switches while its chat DOM does not. Scroll effects must therefore track navigation state individually, even though navigation is not a chat concern.
The same component also owns section routing, transcript scrolling, and detailed turn rendering. Its roughly 1,800 lines are a symptom; the problem is that independently changing responsibilities share one lifecycle and API.
This issue governs a three-stage cleanup. It is not intended to close through one large PR.
Target boundary
ChatView should be the sessions-section chat container:
- app-shell decides whether chat or another section is mounted;
- ChatView owns chat-page composition;
- a scroll seam owns transcript DOM lifecycle;
- a turn seam owns rendering of a materialized turn.
The goal is clear ownership, not a line-count target.
Stage 1 — Page ownership
Move section dispatch to app-shell so ChatView mounts only for sessions.
Outcomes:
ChatViewhas nomodeprop or non-chat branches;- non-chat module props leave the ChatView API;
- app-shell is the single authority for section routing;
- chat effects no longer depend on navigation state;
- existing lazy loading and behavior are preserved.
Acceptance:
-
ChatViewrenders chat only. - No duplicate section dispatch remains.
- The fix(ui): stabilize long-session scroll geometry for content-visibility turns #828 mode-switch scroll regression stays green.
Stage 2 — Turn rendering
Move the rendering of one materialized turn behind a cohesive component boundary.
Outcomes:
ChatViewcomposes the transcript without implementing turn internals;- turn-only helpers remain private to the turn module;
- DOM structure, memoization, and behavior remain unchanged;
- no parallel rendering path or premature subcomponent-per-file split is introduced.
Acceptance:
- A materialized turn has one clear rendering boundary.
-
ChatViewno longer owns turn-level presentation details. - Affected unit, contract, and E2E tests stay green.
Stage 3 — Scroll lifecycle
Move transcript scroll state and effects behind a chat-specific hook or equivalent seam.
Outcomes:
- the seam owns the viewport ref, pinned state, session reset, size following, warm-up, explicit targets, highlighting, and scroll-to-bottom behavior;
- it composes the existing
pinned-bottomandturn-size-warmupmechanisms rather than duplicating them; - it knows nothing about navigation modes or non-chat sections;
- behavior remains unchanged.
Acceptance:
- Scroll state and effects no longer live inline in
ChatView. - Existing scroll mechanisms remain the authoritative implementations.
- The complete scroll-geometry suite stays green.
Delivery
Deliver the stages as three independently reviewable and revertible PRs, in order:
- page ownership;
- turn rendering;
- scroll lifecycle.
Each PR should reference this issue and identify its stage. Close this issue after all three stages merge.
Stop condition
Stop after these boundaries are restored unless a remaining extraction solves a concrete responsibility or defect. Do not split components merely to reduce file length.
Out of scope
- visual or behavioral redesign;
- redesign of message materialization or live-turn projection;
- one-file-per-component cleanup;
- governance of other large files based on size alone.
Activity
[-]refactor(ui): ChatView owns non-chat mode dispatch — lift it to app-shell and split the file[/-][+]refactor(ui): restore ChatView boundaries in three stages[/+]