perf(mobile): pull request screens compile with the React Compiler#21136
The React Compiler skipped every pull request screen and hook. Most used try/catch/finally with a throw inside the try; neither shape compiles.
| Pattern | Files | Fix |
|---|---|---|
try/catch/finally around awaited work, throw inside | usePullRequestAction, usePullRequestListActions, usePullRequestThreads, PullRequestMergeControls, PullRequestReviewersScreen | the try body becomes an async function, and the handlers chain as .catch() and .finally() with the same behavior |
try without catch, or try/finally | PullRequestDiscussionScreen, PullRequestInlineCommentScreen, PullRequestReviewSheet, guide/useReviewGuide | same |
synchronous try/catch containing conditionals | guide/PullRequestGuideScreen, guide/ReviewGuideExcerpt | the body moved into a module helper (diffFilesByPath, excerptPatch) |
| logical expression as a computed object key | usePullRequestListControls | a small helper builds the controls map |
| manual memo deps the compiler couldn't preserve | PullRequestRouteScreen | manual memo removed |
Manual useMemo/useCallback/memo are removed from every file listed. KNOWN_BAILOUTS: 58 → 45.
Verified on device (Pixel 9 API 36 emulator, isolated server with real gh data):
- PR list: changed the state filter to Merged (saved, reloaded) and back to Open.
- PR detail (deep link and from the list): expanded the stack, switched to Activity, and opened a changed file's diff.
- The review sheet opens and accepts typing. I submitted nothing and merged nothing; the merge controls rendered but weren't pressed.
- No red box, and no
useMemoCacheor React errors in the Metro log.
Renders while opening the PR detail screen (measure-renders --route, median of 3, same base and device):
| Route | Before | After |
|---|---|---|
PR detail (#21119) | 10146 | 10048 |
About 1% fewer renders, which is within run-to-run spread (10122 to 10666 before). Call it no measurable change.
Review follow-up
- Pull request actions, merge controls, reviewers, review guide and discussion branch on
AsyncResult.isFailureinstead of throwing a command failure into a.catch. Review sheet, list actions and "Ask about PR" (whose bodies throw validation errors) usesettlePromise. Inline comment save usessettlePromisearound the draft flush. - Not exercised on device: the isolated server has no GitHub access.
Device: Pixel 9 API 36 emulator on nucbox-1, client rebuilt from perf/mobile-compile-8 (the old one lacked the T3FoldPosture native view), Metro and an isolated seeded server on cups.
Claude Opus 5.5 via Claude Code.
🤖 Generated with Claude Code
Checks
Approvability
Verdict: Approved at a1d99fc
Macroscope's review found this PR approvable — This is a focused React Compiler compatibility refactor across existing mobile pull-request flows, removing compiler bailouts while preserving their current command, refresh, navigation, and persistence behavior. It introduces no schema, security-sensitive, deployment, product-default, or static-analysis-suppression changes.
No code changes detected at 2ed1a78. Prior analysis still applies.
You can add or adjust custom eligibility rules. Learn more.
Note
Reviews paused
It looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the reviews.auto_review.auto_pause_after_reviewed_commits setting.
- Last reviewed commit: 3b6ac34286f041bf83eabd378013326cc49dfb3a
- Latest commit, not reviewed: 2ed1a78e84e22d42442c54c521ec303510b78431
Use the following commands to manage reviews:
@coderabbitai resumeto resume automatic reviews.@coderabbitai reviewto trigger a single review.
Use the checkboxes below for quick actions:
- ▶️ Resume reviews
- 🔍 Trigger review
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:
4d26a85d-6421-40e6-bea5-681a88077f72
📥 Commits
Reviewing files that changed from the base of the PR and between df025bcabe26114c9bd0110f5f2db663705eaad3 and 3b6ac34286f041bf83eabd378013326cc49dfb3a.
📒 Files selected for processing: 1
apps/mobile/src/features/pull-requests/PullRequestMergeControls.tsx
Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 0 remain after this review.
📝 Walkthrough
Pull-request screens and hooks now handle operation failures through
AsyncResultvalues or settled promises. Several screens and hooks also replace memoized callbacks and calculations with direct expressions. Review-guide screens add helpers for patch-file mapping and excerpt patch construction.Changes: Pull-request mobile screens and hooks
Layer / File(s) Summary Async operation result handling
apps/mobile/src/features/pull-requests/PullRequestDiscussionScreen.tsx,PullRequestInlineCommentScreen.tsx,PullRequestMergeControls.tsx,PullRequestReviewSheet.tsx,PullRequestReviewersScreen.tsx,guide/useReviewGuide.ts,usePullRequestAction.ts,usePullRequestListActions.ts,usePullRequestThreads.tsOperations inspect returned failures or settled promises, then update pending or busy state and report errors. Successful operations retain their refreshes, navigation, or other completion behavior. Several handlers do not clean up when an operation rejects. Direct callbacks and render calculations
apps/mobile/src/features/pull-requests/PullRequestRouteScreen.tsx,PullRequestInlineCommentScreen.tsx,PullRequestReviewSheet.tsx,PullRequestReviewersScreen.tsx,usePullRequestListActions.ts,usePullRequestListControls.ts,guide/useReviewGuide.ts,apps/mobile/src/reactCompilerCoverage.test.tsScreens and hooks replace memoized callbacks and values with direct functions or calculations. The compiler coverage test removes the updated pull-request files from its known bailout list. Review-guide diff extraction
apps/mobile/src/features/pull-requests/guide/PullRequestGuideScreen.tsx,apps/mobile/src/features/pull-requests/guide/ReviewGuideExcerpt.tsxExcerpt data is calculated directly. Helpers map patch files by current and previous paths and build excerpt patches. Patch construction returns an empty string when the file is absent or extraction throws. Priority: ➖ Normal
Estimated code review effort: 3 (Moderate) | ~20 minutes
Change: Refactor
Suggested reviewers:
flamboh
Merge Risk: ⚪ Minimal · up to 3b6ac
No actionable regression is established for this change; it is mergeable after normal checks.
Pre-merge checks: Passed 4
Check name Status Explanation 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. Title check Passed The title clearly and concisely identifies the main change: enabling React Compiler compilation for mobile pull request screens. Description check Passed The description clearly explains the compiler bailout problem, the code changes, affected files, verification steps, measured results, and untested flows. It does not include an explicit Scope and app… Full details: Description check
Explanation
The description clearly explains the compiler bailout problem, the code changes, affected files, verification steps, measured results, and untested flows. It does not include an explicit Scope and approval section or approval reference, but the core required information is present.
✨ 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
Comment @coderabbitai help to get the list of available commands.
Thread transfer impact
⚠️ The latest CI run did not produce a thread transfer result for 943366b.
This comment will update automatically after the next completed run.