refactor(web): ChatView's pull request checkout lives in usePullRequestDraftThread#23070

merged1
refactor/split2-chatview-composer-selection
refactor/split2-chatview-pr-draft
opened2d agobyJJulius Marminge
View on GitHubTwo-way sync enabledPR last imported 2d ago

Opening the pull request dialog and placing the prepared branch or worktree on the project's draft thread move into chat/usePullRequestDraftThread.ts. Verbatim move.

BeforeAfter
ChatView.tsx lines4,2714,190

Tests: tsc-rs --noEmit for apps/web, oxlint on the changed files, vp test run src/components/ChatView.logic.test.ts, and the React Compiler coverage test for every changed file (0 bailouts). ChatView stays in the coverage test's slow set.

Part of the ChatView split (7,258 → 3,975 lines across the stack).

Opus 5.5, Claude Code.

🤖 Generated with Claude Code

Checks

All checks passed
Synced from GitHub

Approvability

Verdict: Approved at 6b61b05

Macroscope's review found this PR approvable — This PR extracts the existing pull-request checkout and draft-thread handling from ChatView into a dedicated hook while preserving the same call sites and workflow. It introduces no new capability, schema change, product-default change, or static-analysis override.

No code changes detected at c8c87af. Prior analysis still applies.

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: 755ea676-2d11-4367-9e6d-4b61db49614f
📥 Commits

Reviewing files that changed from the base of the PR and between 6b61b052f75856af7162bc1ad38b16fb62445833 and c8c87afdbfeacdcaaeec94927259a84dd7ba0f48.

📒 Files selected for processing: 1
  • apps/web/src/components/ChatView.tsx

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

📝 Walkthrough

Pull-request draft-thread preparation and dialog handling moved from ChatView into the new usePullRequestDraftThread hook. ChatView passes the relevant state to the hook and uses its returned callbacks.

Changes: Pull-request draft-thread workflow

Layer / File(s)Summary
Draft-thread preparation and dialog handling
apps/web/src/components/chat/usePullRequestDraftThread.ts
The new hook gates dialog opening, reuses or updates draft sessions when applicable, and otherwise creates and navigates to a draft thread with pull-request context.
ChatView hook integration
apps/web/src/components/ChatView.tsx
ChatView calls the hook and uses its callbacks. The inline workflow and its unused imports and selectors were removed.

Priority: ⬇️ Low

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

Change: Refactor

Suggested reviewers: t3dotgg

Merge Risk: ⚪ Minimal · up to c8c87

The pull-request draft-thread workflow appears unchanged by the extraction and is ready to merge after normal checks.

Pre-merge checks: Passed 3 · Failed 1

Failed Failed checks: 1 warning

Check nameStatusExplanationResolution
Description checkWarningThe description explains the code change and lists verification commands, but it omits the required Problem and Scope and approval sections. Verification also does not state observed results or any ch…Add Problem and Scope and approval sections. Describe the expected behavior and motivation. Provide the issue or maintainer approval, or explain why an exemption applies. Expand Verification with observed results and any unavailable checks.…
Passed Passed checks: 3 passed
Check nameStatusExplanation
Title checkPassedThe title clearly and concisely describes the main refactor: moving ChatView pull request checkout logic into usePullRequestDraftThread.
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 code change and lists verification commands, but it omits the required Problem and Scope and approval sections. Verification also does not state observed results or any checks that could not be completed.

Resolution

Add Problem and Scope and approval sections. Describe the expected behavior and motivation. Provide the issue or maintainer approval, or explain why an exemption applies. Expand Verification with observed results and any unavailable checks. Include UI evidence if the refactor changes user-visible 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

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.

Synced from GitHub

Thread transfer impact

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

This comment will update automatically after the next completed run.

Added 1 commit

  • refactor(web): ChatView's pull request checkout lives in usePullRequestDraftThreadc8c87af