The best way to control Claude Code, Codex and more from any computer or phone
Mirrored from https://github.com/Camo67/t3code.git
Synced Nov 21, 08:30 UTC
fix(web): unsaved PR review comments survive a light/dark switch (#38004)
Julius Marminge committed
Nov 17, 2026 at 00:29 UTC
f98249acad344b021f074d483be8643d79928c2e
2 files changed
+63
-6
apps/web/src/components/pullRequest/PullRequestCodeTab.browser.test.tsx
+61
@@ -12,6 +12,7 @@ import { userEvent } from "vite-plus/test/browser";
12
13
import "~/index.css";
14
import { __setClientSettingsForTests } from "../../hooks/useSettings";
15
+import { setAppearanceMode } from "../../hooks/useTheme";
16
import { DEFAULT_CLIENT_SETTINGS } from "@t3tools/contracts/settings";
17
18
const { diffAtom, pagedDiffAtom } = await vi.hoisted(async () => {
@@ -499,3 +500,63 @@ it("hides a resolved conversation behind avatars on its line until they are clic
500
.element(screen.getByRole("button", { name: "2 resolved conversations" }))
501
.toBeVisible();
502
});
503
+
504
+// regression: #37996
505
+it("keeps an unsent reply when the appearance switches between light and dark", async () => {
506
+ setup({ paged: false });
507
+ __setClientSettingsForTests({ ...DEFAULT_CLIENT_SETTINGS, diffFilesCollapsed: false });
508
+ setAppearanceMode("dark");
509
+ using _preferences = {
510
+ [Symbol.dispose]() {
511
+ __setClientSettingsForTests(DEFAULT_CLIENT_SETTINGS);
512
+ setAppearanceMode("system");
513
+ },
514
+ };
515
+ const container = document.createElement("div");
516
+ container.className = "flex h-[700px] w-[900px]";
517
+ await using screen = await render(
518
+ <PullRequestCodeTab
519
+ scrollerRef={() => {}}
520
+ environmentId={EnvironmentId.make("environment")}
521
+ reference={detail}
522
+ detail={{
523
+ ...detail,
524
+ capabilities: {
525
+ ...detail.capabilities,
526
+ review: { ...detail.capabilities.review, reply: true },
527
+ },
528
+ viewerPermissions: { ...detail.viewerPermissions, comment: true },
529
+ reviewThreads: [
530
+ {
531
+ id: "thread",
532
+ path: "a.ts",
533
+ line: 3,
534
+ side: "right",
535
+ isResolved: false,
536
+ isOutdated: false,
537
+ comments: [
538
+ {
539
+ id: "comment",
540
+ author: { login: "reviewer", name: null, avatarUrl: null },
541
+ body: "Rename this.",
542
+ createdAt: "2026-09-01T00:00:00Z",
543
+ url: null,
544
+ },
545
+ ],
546
+ },
547
+ ],
548
+ }}
549
+ selectedCommitOid={null}
550
+ onSelectedCommitChange={() => {}}
551
+ onRefresh={() => {}}
552
+ />,
553
+ { container },
554
+ );
555
+ const reply = () => screen.getByRole("textbox", { name: "Reply to this conversation" });
556
+ await screen.getByRole("button", { name: "Reply", exact: true }).click();
557
+ await reply().fill("Unsent");
558
+
559
+ setAppearanceMode("light");
560
+
561
+ await expect.element(reply()).toHaveValue("Unsent");
562
+});
apps/web/src/components/pullRequest/PullRequestCodeTab.tsx
+2
-6
@@ -651,11 +651,7 @@ function PullRequestCodeTab({
651
parsedSlices,
652
loadedFiles: pagedFiles,
653
sourceFileStats,
654
- } = diffModel(
655
- loadedSlices,
656
- `pull-request:${scopeKey}:${resolvedTheme}:${ignoreWhitespace}`,
657
- ignoreWhitespace,
658
- );
654
+ } = diffModel(loadedSlices, `pull-request:${scopeKey}:${ignoreWhitespace}`, ignoreWhitespace);
655
const withheldResults = useAtomValue(
656
withheldFileDiffsAtom(
657
JSON.stringify({ environmentId, input: withheldInput, paths: withheldPaths }),
@@ -684,7 +680,7 @@ function PullRequestCodeTab({
680
nextCursor: null,
681
omittedFileStats: [],
682
},
687
- `pull-request:${scopeKey}:${resolvedTheme}:withheld:${path}`,
683
+ `pull-request:${scopeKey}:withheld:${path}`,
684
// Cut lines can match up to the cut and differ after it; hiding them would drop changes.
685
false,
686
);