fix(web): the branch toolbar and thread details panel stay cached while a reply streams#23103

merged1
refactor/split3-chatview-banner-lane
refactor/split3-chatview-start-from-origin
opened2d agobyJJulius Marminge
View on GitHubTwo-way sync enabledPR last imported 2d ago

While a reply streams, BranchToolbar and the thread details panel re-rendered on every update. useComposerSelection's onStartFromOriginChange closed over the whole activeThread shell, which changes with each streamed event, so both components got a new handler each time.

The handler now reads only the thread id, which the compiler can cache on.

Streaming a 12-line reply (median of 3, about 110 commits):

Componentbeforeafter
BranchToolbar100
ThreadDetailsSection100

Total renders are noise-bound for streaming (2,866 before, 2,891 after; the runs swing by ±20% with response length).

Tested:

  • apps/web typecheck and lint on the touched file.
  • React Compiler: 0 bailouts on useComposerSelection.ts.
  • Hands-on in a dev build, draft thread: switch the workspace to New worktree, open the base branch picker, and flip "Start from remote" off and back on.

🤖 Generated with Claude Code

Checks

All checks passed

Added 1 commit

  • fix(web): the branch toolbar and thread details panel stay cached while a reply streams937507c
Synced from GitHub

Approvability

Verdict: Approved at 937507c

Macroscope's review found this PR approvable — This is a focused one-file rendering-performance fix that preserves the handler’s behavior while avoiding unnecessary BranchToolbar and thread-details rerenders during streamed replies. It introduces no new capability, product-default change, or static-analysis suppression.

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: bcaebd2e-d2d2-4edb-b0bc-3c4fe8827167
📥 Commits

Reviewing files that changed from the base of the PR and between 54349ea3e2f4799c90fdb701bfe12e55526bd618 and 937507c6a4cca85c0d72133ac4ddf7ff643172f5.

📒 Files selected for processing: 1
  • apps/web/src/components/chat/useComposerSelection.ts

Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 1 remain after this review.

📝 Walkthrough

The start-from-origin callback now uses the active thread ID to update pending server-thread state. Local draft threads continue to update draft context.

Changes: Composer selection

Layer / File(s)Summary
Start-from-origin update
apps/web/src/components/chat/useComposerSelection.ts
The callback uses the active thread ID for the server override check and pending-state update. Equality-based no-op updates and the local-draft fallback remain.

Priority: ⬇️ Low

Estimated code review effort: 2 (Simple) | ~8 minutes

Change: Bug fix

Merge Risk: ⚪ Minimal · up to 93750

The change is mergeable; the callback optimization preserves existing behavior without an actionable correctness or runtime risk.

Pre-merge checks: Passed 3 · Failed 1

Failed Failed checks: 1 warning

Check nameStatusExplanationResolution
Description checkWarningThe description clearly explains the problem, change, measurements, verification, and agent usage. It does not include the required Scope and approval section or UI before/after screenshots, and it do…Add a Scope and approval section with the triaged issue or maintainer approval, or explain why this focused obvious bug qualifies for the exemption. Add clear before/after UI screenshots and a short recording if needed to demonstrate the st…
Passed Passed checks: 3 passed
Check nameStatusExplanation
Title checkPassedThe title clearly identifies the web performance fix: keeping the branch toolbar and thread details panel cached during streaming.
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 clearly explains the problem, change, measurements, verification, and agent usage. It does not include the required Scope and approval section or UI before/after screenshots, and it does not provide a recording for the streaming interaction.

Resolution

Add a Scope and approval section with the triaged issue or maintainer approval, or explain why this focused obvious bug qualifies for the exemption. Add clear before/after UI screenshots and a short recording if needed to demonstrate the streaming behavior.

✨ Finishing Touches
📝 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

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