refactor(web): ChatView's machine and server-update banners live in useSystemComposerBanners#22710

merged1
refactor/chatview-timeline-follow
refactor/chatview-system-banners
opened3d agobyJJulius Marminge
View on GitHubTwo-way sync enabledPR last imported 3d ago

ChatView spread about 260 lines of state for the composer's system banners across two places: reconnect grace, disconnect, version mismatch, and server update. All of it ended up as one systemComposerBannerItems array.

chat/useSystemComposerBanners.tsx now builds that array and owns the retry and disable commands. EnvironmentUnavailableState moved there too. ChatView keeps the active environment and its unavailable state, which other code still reads.

previous layerthis layer
ChatView.tsx lines7,9277,665

Renders were counted with the rc-init.js fiber counter on a dev server seeded from real data (median of 3 runs; base 6a6c84f vs the stack top before its rebase onto current main):

Interactionmain: commits / renders (ChatView)stack top: commits / renders (ChatView)
Type 20 chars in the composer22 / 678 (1)22 / 678 (1)
Switch threads14 / 779 (5)14 / 777 (5)
Open + close the terminal drawer15 / 494 (3)15 / 497 (3)
Open + close the right panel21 / 723 (4)21 / 726 (4)
Drag the right panel's resize handle13 / 139 (1)1 / 1 (0)

The +3 renders are the new ChatTerminalDrawers and ChatRightPanel wrappers. The drag row is the right panel layer: the drag's final width commit used to re-render ChatView and the whole chat column, and now re-renders only ChatRightPanel.

Tests: vp test run src/reactCompilerCoverage.test.ts for ChatView and every new file (0 bailouts), tsc-rs --noEmit for apps/web, and oxlint on the changed files.

🤖 Generated with Claude Code

Checks

All checks passed

Added 1 commit

  • refactor(web): ChatView's machine and server-update banners live in useSystemComposerBanners7de6e9a
Synced from GitHub

Thread transfer impact

⚠️ The latest CI run did not produce a thread transfer result for 7de6e9a.

This comment will update automatically after the next completed run.

Synced from GitHub

Approvability

Verdict: Approved at 7de6e9a

Macroscope's review found this PR approvable — This PR moves existing machine availability, reconnect, disconnect, server-update, and auto-balance banner logic from ChatView into a dedicated hook while preserving the existing conditions and actions. It is an isolated production-code reorganization with no schema, product-default, security, billing, or deployment changes.

You can add or adjust custom eligibility rules. Learn more.

Synced from GitHub

Review in Change Stack →

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration
  • Configuration used: Path: .coderabbit.config.ts
  • Review profile: CHILL
  • Plan: Team
  • Run ID: be234740-98c3-4a00-91a9-ac010d973206
📥 Commits

Reviewing files that changed from the base of the PR and between c61cf64dae5de0bba59018c60d73e15b1061b846 and 7de6e9a6fca9d5acba44242a5a102749d4878e08.

📒 Files selected for processing: 2
  • apps/web/src/components/ChatView.tsx
  • apps/web/src/components/chat/useSystemComposerBanners.tsx

Limit details: You’ve used all 10 included reviews currently available.

📝 Walkthrough

ChatView now delegates system composer banner construction to useSystemComposerBanners. The hook handles environment availability, reconnect and disconnect actions, server version and update states, and automatic-balance notices. ChatView determines environment availability from the active connection phase and passes environment and server state to the hook.

Changes: System composer banners

Layer / File(s)Summary
Environment availability and recovery
apps/web/src/components/ChatView.tsx, apps/web/src/components/chat/useSystemComposerBanners.tsx
The hook manages reconnect grace periods, reconnect and disconnect actions, and unavailable-environment banners. ChatView checks the active connection phase and removes its local recovery handlers.
Update and balance banners
apps/web/src/components/ChatView.tsx, apps/web/src/components/chat/useSystemComposerBanners.tsx
The hook builds server update and automatic-balance banners. ChatView passes the required environment and server state to the hook.

Priority: ⬇️ Low

Estimated code review effort: 3 (Moderate) | ~25 minutes

Change: Refactor

Possibly related issues

  • pingdotgg/t3code#22741 — The hook includes failed-update status and retry actions, but the underlying Vite+ shim resolution problem remains outside this change.

Suggested reviewers: t3dotgg

Merge Risk: ⚪ Minimal · up to 7de6e

No actionable issue remains from this change; it is ready for normal merge checks.

Pre-merge checks: Passed 3 · Failed 1

Failed Failed checks: 1 warning

Check nameStatusExplanationResolution
Description checkWarningThe description explains the refactor and includes detailed verification results. It does not provide the required scope and approval information, and it does not clearly identify the problem with exp…Add the required Problem, Change, Scope and approval, and Verification sections. Include the linked issue or explicit maintainer approval, or explain why this focused refactor does not require prior approval. State the problem and expected …
Passed Passed checks: 3 passed
Check nameStatusExplanation
Title checkPassedThe title clearly describes the main change: moving ChatView composer machine and server-update banners into useSystemComposerBanners.
Linked Issues checkPassedCheck skipped because no linked issues were found for this pull request.
Out of Scope Changes checkPassedCheck skipped because no linked issues were found for this pull request.
Full details: Description check

Explanation

The description explains the refactor and includes detailed verification results. It does not provide the required scope and approval information, and it does not clearly identify the problem with expected behavior or reproduction context.

Resolution

Add the required Problem, Change, Scope and approval, and Verification sections. Include the linked issue or explicit maintainer approval, or explain why this focused refactor does not require prior approval. State the problem and expected behavior more directly.

✨ Finishing Touches: 💡 1
🛠️ Fix failing CI checks: 💡
  • Commit to this branch
  • Create a new PR
📝 Generate docstrings
  • Commit to this branch
  • Create a new PR
🧪 Generate unit tests (beta)
  • Commit to this branch
  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Usage-based review receipt

Note

This review was completed with usage-based billing: files reviewed beyond your plan's included limits are billed at $0.25/file. View usage-based billing.

Comment @coderabbitai help to get the list of available commands.