Repository navigation
fix(web): unsaved PR review comments survive a light/dark switch - #38004
Conversation
Fails on main: the Code tab's diff model is keyed by the rendered appearance, so switching it re-parses the files, folds them back and remounts their annotations, dropping any unsaved comment text. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The Code tab keyed its parsed diff model by the rendered appearance, so a theme change re-parsed every file into new objects with new render keys. That folded the files again and remounted their annotations, discarding unsaved comment, reply and edit text. The diff worker pool already follows the appearance and re-highlights mounted diffs, so the theme is dropped from both parse keys. Fixes #37996 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
commented
Nov 17, 2026
ApprovabilityVerdict: Approved at Macroscope's review found this PR approvable — Theme switches now preserve PR diff identities, allowing unsaved review comments to remain in place. PR and commit isolation remain intact, with no changes to comment submission or permissions. You can add or adjust custom eligibility rules. Learn more. |
|
No actionable comments were generated in the recent review. Walkthrough
Merge Risk:
|
Nothing needed changing in this round. The brief listed no items, and PR #38004 at 9c7c3e4 is green: all 39 checks passed, including the 8 required ones. Macroscope approved (Approvability: approved). CodeRabbit generated no actionable comments, and there are no line comments, so no high-or-above finding is open. The fix is unchanged: it removes
${resolvedTheme}from PullRequestCodeTab's diffModel and withheld-file parse cache keys. A light/dark switch therefore keeps the same parsed file objects and render keys, so fold state and open comment, reply and edit editors survive. The shared diff worker pool still re-highlights mounted diffs when the theme changes.Fixes #37996
Reproduction on main
Commit 49c3ab8 (origin/main). Ran
T3CODE_DEV_SEED=0 vp run devin a fresh worktree, added the worktree (origin = pingdotgg/t3code) as a project, paired the preview browser, opened Pull requests > #30045 > Code tab, emulated prefers-color-scheme: dark, expanded ComposerPrimaryActions.tsx, clicked the gutter '+' on line 12, and typed 'Long unsaved review comment draft' into the 'Comment on lines …:12' textarea without saving. Switched prefers-color-scheme to light: the line-comment textarea was gone from the DOM (only 'Review summary' and 'Comment on this pull request' remained) and the file was folded closed again. Expanding the file did not bring the editor or the text back. Failing test on factory/repro-37996: 'keeps an unsent reply when the appearance switches between light and dark' in apps/web/src/components/pullRequest/PullRequestCodeTab.browser.test.tsx. It opens a reply on a review thread, fills 'Unsent', calls setAppearanceMode('light') after starting in dark, and fails because the reply textbox no longer exists (the ARIA tree shows only '1 file', so the file folded). With the appearance switch removed, the same test passes.Evidence
Real Chromium web client, 1280×800, fresh isolated database on each commit. Open #30045 → Code → expand ComposerPrimaryActions.tsx → gutter plus on line 12 → type
Long unsaved review comment draftwithout saving → switch prefers-color-scheme from dark to light.Proven: scenarios:prove exited 0, failing on base and passing on head. On base the file folded and the editor disappeared. On head the file stayed expanded and the complete draft remained visible.
Scenario source
Not shown:
Tests
No new commands this round. Read the CI results on GitHub: all 39 check runs on 9c7c3e4 passed, including Test Web 1/2, Lint, and Build and Typecheck. From the earlier step: PullRequestCodeTab.browser.test.tsx 9/9 pass, and vp run check:changed passes.
Not in this change
diff-panel:${resolvedTheme}) and useReviewFilePatches (diff-panel:${theme}) also put the theme into their parse cache keys, so their per-file state may reset the same way on a theme switch; not changed here because the issue is about the PR Code tab.diff-panel:${resolvedTheme}) and useReviewFilePatches (diff-panel:${theme}) also put the theme into their parse cache keys, so their per-file state may reset on a theme switch the same way; not changed here.Who did the work
Run by the t3code factory in T3 Code.