* Add formatting conventions * Add a fmt lint check * rely on defaults --------- Co-authored-by: Julius Marminge <[email protected]>
1.2 KiB
1.2 KiB
Plan: Split ChatView into Smaller UI/Logic Units
Summary
Refactor ChatView.tsx into composable pieces with isolated responsibilities.
Motivation
apps/renderer/src/components/ChatView.tsxis large and handles:- Session orchestration
- Send/interrupt actions
- Timeline rendering
- Header/status UI
- Composer UI
- Hard to test and maintain as one component.
Scope
- Renderer component boundaries and hooks.
- Keep visual behavior unchanged.
Proposed Changes
- Create hook:
apps/renderer/src/hooks/useChatSession.tsensureSessionsendTurninterruptTurn
- Split presentational components:
components/chat/ThreadHeader.tsxcomponents/chat/MessageTimeline.tsxcomponents/chat/ComposerBar.tsx
- Keep
ChatView.tsxas container wiring store + hook + child components. - Add focused tests for hook behavior (error handling, session reuse).
Risks
- Refactor can break subtle UI interactions (auto-scroll, menu close, keyboard send).
Validation
bun run test- Manual smoke: send, stream, interrupt, model switch.
Done Criteria
ChatView.tsxsignificantly reduced and easier to scan.- Session logic isolated from rendering.