🤖 perf: let React Compiler compile ImmersiveReviewView - #4457
Merged
Merged
Conversation
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
ImmersiveReviewViewnow compiles under React Compiler and leaves the guard'sKNOWN_SKIPPEDbaseline (17/18 hot components compile). Iterating hunks in immersive review spends about 18% less script time.Background
Follow-up to the React Compiler coverage stack (#4422, #4425–#4429) and #4439. The compiler skipped the whole component because of
??=, atry/catch/finallyin the copy-file handler, three render-time ref writes, and one ref read during render.Implementation
oldLineMap ??= …becomesoldLineMap = oldLineMap ?? ….try/catch/finallyusesrunWithCatchFinallywith the same body, error handler, and cleanup. Earlyreturns keep their meaning because thetrywas the handler's last statement.activeFilePathRef,activeFileContentVersionRef, andhandleCopyFileRefare synced inuseLayoutEffectinstead of during render. Layout effects run in the commit's task, before passive effects, which is the ordering the existing comment requires forisStale().selectedLineSummary(render path) readhunkJumpLineRangeRefthroughgetCurrentLineSelection. A state mirror,hunkJumpLineRange, now feeds render. Every ref write also sets the state, next to the cursor/selection updates it batches with, and the hot-path callbacks keep reading the ref, so their identities stay stable. One visible difference: after a comment submit or composer cancel that clears the hunk-jump range while no line selection is active, the "Lines …" label now updates right away. Before, it kept showing the cleared range until the next render.Validation
17/18 hot components compile (1 known skipped);make static-checkgreen.src/browser/features/RightSidebar/CodeReviewunit tests (79) andtests/ui/review(14) pass.Measurements
Electron perf e2e, local, serial, 5 runs each,
mainat 334a5a6 vs this branch. ScriptDuration per run:Hunk-iteration wall time went from 448 to 376 ms (median). The regular review reopen scenario, which doesn't render this component, moved about 10% between runs, which is this host's noise level. The hunk-iteration ranges don't overlap.
Generated with
xum• Model:anthropic:claude-opus-5-5• Thinking:high• Cost:$4.05