@devries-cameron20 / t3code Mirror · read-only / commits / 3331b93937
Fork 0

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 22, 09:30 UTC

fix(web): show linked pull request state in command palette rows (#23156)

Co-authored-by: GPT-6.1 Sol <noreply@openai.com>

Victor Vogel committed Oct 31, 2026 at 21:24 UTC 3331b9393755ca6fe0e7880f953ae0f36ec0f627
2 files changed +73 -2
apps/web/src/components/ThreadStatusIndicators.linkedPr.browser.test.tsx new
+66
@@ -0,0 +1,66 @@
1 +import { EnvironmentId, type ThreadPullRequestLink } from "@t3tools/contracts";
2 +import { expect, it, vi } from "vite-plus/test";
3 +
4 +import { render } from "../../test/render";
5 +import { AppAtomRegistryProvider } from "../rpc/atomRegistry";
6 +import { makeThreadFixture } from "../test-fixtures";
7 +import { ThreadRowLeadingStatus } from "./ThreadStatusIndicators";
8 +
9 +const environmentId = EnvironmentId.make("environment-test");
10 +
11 +vi.mock(import("../state/entities"), async (original) => ({
12 + ...(await original()),
13 + useProject: () => null,
14 + useServerConfigs: (() =>
15 + new Map([
16 + [environmentId, { environment: { capabilities: { threadPullRequests: true } } }],
17 + ])) as never,
18 +}));
19 +
20 +it("updates palette PR status from linked snapshots without a legacy link or branch PR", async () => {
21 + const link: ThreadPullRequestLink = {
22 + host: "github.com",
23 + repository: "example/repo",
24 + number: 7,
25 + url: "https://github.com/example/repo/pull/7",
26 + source: "manual",
27 + linkedAt: "2026-01-01T00:00:00Z",
28 + stack: null,
29 + snapshot: {
30 + state: "merged",
31 + title: "Linked change",
32 + headBranch: "deleted-branch",
33 + baseBranch: "main",
34 + isDraft: false,
35 + updatedAt: null,
36 + syncedAt: "2026-01-03T00:00:00Z",
37 + },
38 + };
39 + const row = (pullRequest: ThreadPullRequestLink) => (
40 + <AppAtomRegistryProvider>
41 + <ThreadRowLeadingStatus
42 + thread={makeThreadFixture({
43 + environmentId,
44 + linkedPullRequest: null,
45 + branchPullRequest: null,
46 + pullRequests: [pullRequest],
47 + })}
48 + />
49 + </AppAtomRegistryProvider>
50 + );
51 + await using screen = await render(row(link));
52 + await expect.element(screen.getByLabelText("PR #7 - Merged: Linked change")).toBeVisible();
53 + await expect.element(screen.getByLabelText("PR #7, status pending")).not.toBeInTheDocument();
54 +
55 + await screen.rerender(row({ ...link, snapshot: null }));
56 + await expect.element(screen.getByLabelText("PR #7, status pending")).toBeVisible();
57 + await expect
58 + .element(screen.getByLabelText("PR #7 - Merged: Linked change"))
59 + .not.toBeInTheDocument();
60 +
61 + await screen.rerender(
62 + row({ ...link, snapshot: { ...link.snapshot!, state: "open", isDraft: true } }),
63 + );
64 + await expect.element(screen.getByLabelText("PR #7 - Draft: Linked change")).toBeVisible();
65 + await expect.element(screen.getByLabelText("PR #7, status pending")).not.toBeInTheDocument();
66 +});
apps/web/src/components/ThreadStatusIndicators.tsx
+7 -2
@@ -674,6 +674,8 @@ export function ThreadRowLeadingStatus({ thread }: { thread: SidebarThreadSummar
674 thread.environmentId,
675 thread.linkedPullRequest,
676 leaseLiveStatus,
677 + thread.pullRequests,
678 + thread.branchPullRequest,
679 );
680 const gitStatus = useEnvironmentQuery(
681 leaseLiveStatus &&
@@ -696,8 +698,11 @@ export function ThreadRowLeadingStatus({ thread }: { thread: SidebarThreadSummar
698 linkedPullRequest: thread.linkedPullRequest,
699 linkedPullRequestStatus: linkedPullRequest,
700 };
699 - const pr = resolveDisplayedThreadPr(displayedPrInput);
700 - const prStatus = prStatusIndicator(pr, resolveDisplayedThreadPrProvider(displayedPrInput));
701 + const pr = linkedPullRequest?.pr ?? resolveDisplayedThreadPr(displayedPrInput);
702 + const prStatus = prStatusIndicator(
703 + pr,
704 + linkedPullRequest?.sourceControlProvider ?? resolveDisplayedThreadPrProvider(displayedPrInput),
705 + );
706 const threadStatus = resolveThreadStatusPill({
707 thread: {
708 ...thread,