Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import { userEvent } from "vite-plus/test/browser";

import "~/index.css";
import { __setClientSettingsForTests } from "../../hooks/useSettings";
import { setAppearanceMode } from "../../hooks/useTheme";
import { DEFAULT_CLIENT_SETTINGS } from "@t3tools/contracts/settings";

const { diffAtom, pagedDiffAtom } = await vi.hoisted(async () => {
Expand Down Expand Up @@ -499,3 +500,63 @@ it("hides a resolved conversation behind avatars on its line until they are clic
.element(screen.getByRole("button", { name: "2 resolved conversations" }))
.toBeVisible();
});

// regression: #37996
it("keeps an unsent reply when the appearance switches between light and dark", async () => {
setup({ paged: false });
__setClientSettingsForTests({ ...DEFAULT_CLIENT_SETTINGS, diffFilesCollapsed: false });
setAppearanceMode("dark");
using _preferences = {
[Symbol.dispose]() {
__setClientSettingsForTests(DEFAULT_CLIENT_SETTINGS);
setAppearanceMode("system");
},
};
const container = document.createElement("div");
container.className = "flex h-[700px] w-[900px]";
await using screen = await render(
<PullRequestCodeTab
scrollerRef={() => {}}
environmentId={EnvironmentId.make("environment")}
reference={detail}
detail={{
...detail,
capabilities: {
...detail.capabilities,
review: { ...detail.capabilities.review, reply: true },
},
viewerPermissions: { ...detail.viewerPermissions, comment: true },
reviewThreads: [
{
id: "thread",
path: "a.ts",
line: 3,
side: "right",
isResolved: false,
isOutdated: false,
comments: [
{
id: "comment",
author: { login: "reviewer", name: null, avatarUrl: null },
body: "Rename this.",
createdAt: "2026-09-01T00:00:00Z",
url: null,
},
],
},
],
}}
selectedCommitOid={null}
onSelectedCommitChange={() => {}}
onRefresh={() => {}}
/>,
{ container },
);
const reply = () => screen.getByRole("textbox", { name: "Reply to this conversation" });
await screen.getByRole("button", { name: "Reply", exact: true }).click();
await reply().fill("Unsent");

setAppearanceMode("light");

await expect.element(reply()).toHaveValue("Unsent");
});
8 changes: 2 additions & 6 deletions apps/web/src/components/pullRequest/PullRequestCodeTab.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -651,11 +651,7 @@ function PullRequestCodeTab({
parsedSlices,
loadedFiles: pagedFiles,
sourceFileStats,
} = diffModel(
loadedSlices,
`pull-request:${scopeKey}:${resolvedTheme}:${ignoreWhitespace}`,
ignoreWhitespace,
);
} = diffModel(loadedSlices, `pull-request:${scopeKey}:${ignoreWhitespace}`, ignoreWhitespace);
const withheldResults = useAtomValue(
withheldFileDiffsAtom(
JSON.stringify({ environmentId, input: withheldInput, paths: withheldPaths }),
Expand Down Expand Up @@ -684,7 +680,7 @@ function PullRequestCodeTab({
nextCursor: null,
omittedFileStats: [],
},
`pull-request:${scopeKey}:${resolvedTheme}:withheld:${path}`,
`pull-request:${scopeKey}:withheld:${path}`,
// Cut lines can match up to the cut and differ after it; hiding them would drop changes.
false,
);
Expand Down
Loading