refactor(web): the pull request detail loader lives in its own hook#22703
usePullRequestDetail (detail + activity queries, the snapshot cache, and merging in the shared summary and list row) moves out of the panel into usePullRequestDetail.ts, with pullRequestRefKey. Code moved verbatim.
| File | Before | After |
|---|---|---|
| PullRequestDetailPanel.tsx | 1,985 | 1,821 |
| usePullRequestDetail.ts | - | 179 |
Part of the pull request page split stack: #22671 → #22672 → #22702 → #22703 → #22704 → #22705 → #22706.
Measured with the rc-init render counter against a dev server seeded from real data (136 pull requests listed), fresh browser per side, main 6a6c84f990 vs the stack top. Opening a PR detail: 6482 / 947 / 1249 renders on main vs 6331 / 1187 / 956 on the stack (noise, the first open includes data arriving). Switching Summary/Timeline/Code: 2-13 renders per switch on both sides. Holding Shift 3 times on the list: 14952 vs 14937 renders; the page and column no longer re-render (6 + 6 before, 0 after), the rows still do because their speed-mode prop really changes.
Tests run on this layer: tsc --noEmit for apps/web, vp lint on the changed files, vp test run src/reactCompilerCoverage.test.ts -t pullRequest (every new file compiles with 0 bailouts), vp test run src/components/pullRequest/pullRequestsRouteSearch.test.ts.
🤖 Generated with Claude Code
Checks
- SuccessfulCodeRabbitGitHub
Review completed
- Successful
Skipped - Not affected
- Skipped
- Skipped
- Skipped
- SuccessfulRemove preview downloadGitHub
- Skipped
- SuccessfulLabel PR sizeGitHub
- SuccessfulLabel PR 22703GitHub
- Successful
- Successful
- Successful
- Successful
- SuccessfulPrepare PR size configGitHub
- SuccessfulCollect PR targetsGitHub
- SuccessfulCheckGitHub
- Skipped
- SkippedRelease SmokeGitHub
- SkippedRustGitHub
- SuccessfulBuild and TypecheckGitHub
- SuccessfulTest WebGitHub
- SuccessfulTestGitHub
- Skipped
- SuccessfulLabel PR sizeGitHub
- SuccessfulLabel PR 22703GitHub
- SuccessfulTest Server 2GitHub
- SkippedEAS PreviewGitHub
- SuccessfulTest Server 8GitHub
- SuccessfulTest Server 4GitHub
- SuccessfulTest Server 3GitHub
- SuccessfulTest Server 7GitHub
- SuccessfulTest Server 5GitHub
- SuccessfulTest Server 6GitHub
- SuccessfulTest Server 1GitHub
- SuccessfulChangesGitHub
- SuccessfulLintGitHub
- SuccessfulNative fingerprint diffGitHub
- SuccessfulPrepare PR size configGitHub
- SuccessfulCollect PR targetsGitHub
Added 1 commit
- refactor(web): the pull request detail loader lives in its own hooka9ac4ea
Approvability
Verdict: Approved at a9ac4ea
Macroscope's review found this PR approvable — This PR mechanically moves the existing pull-request detail loader and key helper into a dedicated hook module while preserving its implementation and call-site behavior. Its runtime blast radius is limited to module organization, with no product-default, schema, or static-analysis changes.
You can add or adjust custom eligibility rules. Learn more.
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:
6f1e6c2b-e914-4315-ba9e-a18223f41e3d
📥 Commits
Reviewing files that changed from the base of the PR and between 4207420d8e84e7f4937474921a1295c4675601de and a9ac4ea519b445df7faaba75045f0379e587a3cc.
📒 Files selected for processing: 2
apps/web/src/components/pullRequest/PullRequestDetailPanel.tsxapps/web/src/components/pullRequest/usePullRequestDetail.ts
Limit details: You’ve used all 10 included reviews currently available.
📝 Walkthrough
Pull request detail loading and presentation logic moved from
PullRequestDetailPanelintousePullRequestDetail. The hook handles detail and activity queries, snapshots, summary merging, permission shaping, and activity overlays. The panel now imports the hook and its reference-key helper.Changes: Pull request detail hook
Layer / File(s) Summary Load and resolve detail
apps/web/src/components/pullRequest/usePullRequestDetail.tsThe hook defines a stable reference key, converts checks for presentation, loads detail and activity queries, and initializes, synchronizes, and persists detail snapshots. Merge shared and list summaries
apps/web/src/components/pullRequest/usePullRequestDetail.tsThe hook merges the newest shared or list-row summary with resolved detail. It retains resolved values when optional summary fields are undefined. Enrich detail and integrate the hook
apps/web/src/components/pullRequest/usePullRequestDetail.ts,apps/web/src/components/pullRequest/PullRequestDetailPanel.tsxThe hook applies write-scope permissions, overlays activity data, computes the comment count, and returns query and detail state. The panel imports the hook and removes its local implementation. Priority: ⬇️ Low
Estimated code review effort: 3 (Moderate) | ~20 minutes
Change: Refactor
Suggested reviewers:
maria-rcks
Merge Risk: ⚪ Minimal · up to a9ac4
The detail-loading behavior appears preserved, with no identified issue blocking merge after normal checks.
Pre-merge checks: Passed 3 · Failed 1
Failed Failed checks: 1 warning
Check name Status Explanation Resolution Description check Warning The description clearly explains the code change and includes detailed verification results. It does not provide the required Problem section or the required Scope and approval information, including … Add explicit Problem, Change, Scope and approval, and Verification sections. State the underlying problem and expected behavior. Link the triaged issue or maintainer approval for this refactor, or explain why it qualifies for an exemption. Passed Passed checks: 3 passed
Check name Status Explanation Title check Passed The title clearly describes the main change: moving the pull request detail loader into its own hook. It is concise and specific. Linked Issues check Passed Check skipped because no linked issues were found for this pull request. Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.
Full details: Description check
Explanation
The description clearly explains the code change and includes detailed verification results. It does not provide the required Problem section or the required Scope and approval information, including a triaged issue or explicit maintainer approval.
Resolution
Add explicit Problem, Change, Scope and approval, and Verification sections. State the underlying problem and expected behavior. Link the triaged issue or maintainer approval for this refactor, or explain why it qualifies for an exemption.
✨ 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
- Mode: Continue automatically
- Reviewed files: 2
- Charged: $0.50
- View usage details
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.