@devries-cameron20 / t3code-1 / commits / 3dd9706af0
Fork 0

The best way to control Claude Code, Codex and more from any computer or phone

fix(web): long pull request lists no longer hide thread details controls (#20031)

Co-authored-by: Julius Marminge <julius0216@outlook.com>

Tanner Polley committed Oct 19, 2026 at 14:25 UTC 3dd9706af0b36786c4c3a194495cbbaab61707f4
3 files changed +145 -22
apps/web/src/components/chat/ThreadDetailsCard.tsx
+7 -2
@@ -91,8 +91,13 @@ export function ThreadDetailsCard({
91 const measure = () => {
92 const frame = element.closest<HTMLElement>("[data-thread-details-card]");
93 const next = element.offsetHeight + (frame ? frame.offsetHeight - frame.clientHeight : 0);
94 - const lineage = element.querySelector<HTMLElement>("[data-thread-relationships-panel]");
95 - const fittingHeight = next - (lineage?.offsetHeight ?? 0);
94 + // PR lists and lineage scroll as they expand. Counting them toward density would hide
95 + // the section and workspace controls when the user asks to see more rows.
96 + const lists = element.querySelectorAll<HTMLElement>(
97 + "[data-thread-relationships-panel], [data-thread-details-pr-list]",
98 + );
99 + const fittingHeight =
100 + next - Array.from(lists).reduce((sum, list) => sum + list.offsetHeight, 0);
101 setMeasurements((current) => {
102 const heights = current.key === measurementKey ? current.heights : { full: 0, compact: 0 };
103 const fullContentHeight =
apps/web/src/components/chat/ThreadDetailsPrRows.browser.test.tsx
+132 -16
@@ -1,36 +1,96 @@
1 import { EnvironmentId, ThreadId, type ThreadPullRequestLink } from "@t3tools/contracts";
2 -import { act } from "react";
2 +import { act, type ComponentProps } from "react";
3 import { createRoot, type Root } from "react-dom/client";
4 import { afterEach, beforeEach, expect, it, vi } from "vite-plus/test";
5 +import { page, userEvent } from "vite-plus/test/browser";
6 +import "~/index.css";
7
8 const watchCommand = vi.hoisted(() => vi.fn());
9 +const fixture = vi.hoisted(() => ({ realRows: false }));
10
8 -// The row queries its own pull request; this test covers only which rows the list shows.
9 -vi.mock(import("./ThreadDetailsPrRow"), async (importOriginal) => ({
10 - ...(await importOriginal()),
11 - ThreadDetailsPrRow: ({
12 - number,
13 - onStopWatching,
14 - }: {
15 - number: number;
16 - onStopWatching?: (() => void) | undefined;
17 - }) => (
18 - <div data-row={String(number)}>
19 - {onStopWatching ? <button onClick={onStopWatching}>Stop watching #{number}</button> : null}
20 - </div>
21 - ),
22 -}));
11 +// List-only cases isolate query-backed rows; the density case uses their real layout.
12 +vi.mock(import("./ThreadDetailsPrRow"), async (importOriginal) => {
13 + const actual = await importOriginal();
14 + return {
15 + ...actual,
16 + ThreadDetailsPrRow: (props: ComponentProps<typeof actual.ThreadDetailsPrRow>) =>
17 + fixture.realRows ? (
18 + <actual.ThreadDetailsPrRow {...props} />
19 + ) : (
20 + <div data-row={String(props.number)}>
21 + {props.onStopWatching ? (
22 + <button onClick={props.onStopWatching}>Stop watching #{props.number}</button>
23 + ) : null}
24 + </div>
25 + ),
26 + };
27 +});
28 vi.mock(import("~/state/entities"), async (importOriginal) => ({
29 ...(await importOriginal()),
30 useProjects: () => [],
31 + useQuietThreadShell: (() => ({
32 + environmentId: "environment",
33 + projectId: "project",
34 + worktreePath: null,
35 + })) as never,
36 + useProject: (() => ({ workspaceRoot: "/tmp/project" })) as never,
37 + useThreadShellsForProjectRefs: () => [],
38 }));
39 vi.mock(import("~/state/use-atom-command"), async (importOriginal) => ({
40 ...(await importOriginal()),
41 useAtomCommand: (() => watchCommand) as never,
42 }));
43
44 +vi.mock(import("./ChatCanvasContext"), async (original) => ({
45 + ...(await original()),
46 + useChatCanvas: (() => ({
47 + container: { width: 1800, height: 500 },
48 + lane: { padding: 48, minChatWidth: 640 },
49 + layout: { frame: null },
50 + })) as never,
51 +}));
52 +vi.mock(import("../../hooks/useT3ProjectFileScripts"), async (original) => ({
53 + ...(await original()),
54 + useT3ProjectFileScripts: () => [],
55 +}));
56 +vi.mock(import("./ThreadAutomationsPanel"), () => ({ ThreadAutomationsPanel: () => null }));
57 +vi.mock(import("./ThreadRelationshipsControl"), () => ({ ThreadRelationshipsPanel: () => null }));
58 +vi.mock(import("../pullRequest/usePullRequestActions"), async (original) => ({
59 + ...(await original()),
60 + usePullRequestHandoffs: () => ({ handoff: null, startAsk: vi.fn(), startHandoff: vi.fn() }),
61 +}));
62 +vi.mock(import("../BranchToolbarBranchSelector"), () => ({
63 + BranchToolbarBranchSelector: () => (
64 + <ThreadDetailsPrRows
65 + threadRef={threadRef}
66 + links={manyLinks}
67 + currentLink={manyLinks[0]!}
68 + onOpenLink={vi.fn()}
69 + environmentId={threadRef.environmentId}
70 + pr={null}
71 + number={1}
72 + reference={manyLinks[0]!}
73 + status={null}
74 + project={null}
75 + label="#1"
76 + openAriaLabel="Open pull request #1"
77 + onOpen={vi.fn()}
78 + />
79 + ),
80 +}));
81 +
82 +import { PopoverCreateHandle } from "../ui/popover";
83 +import { ThreadDetailsPanel } from "./ThreadDetailsPanel";
84 import { ThreadDetailsPrRows } from "./ThreadDetailsPrRows";
85
86 +const threadRef = {
87 + environmentId: EnvironmentId.make("environment"),
88 + threadId: ThreadId.make("thread"),
89 +};
90 +const manyLinks = Array.from({ length: 70 }, (_, i) =>
91 + link(i + 1, `branch-${i + 1}`, "main", "2026-01-01T00:00:00.000Z"),
92 +);
93 +
94 function link(
95 number: number,
96 headBranch: string,
@@ -73,6 +133,7 @@ afterEach(() => {
133 act(() => root.unmount());
134 container.remove();
135 vi.unstubAllGlobals();
136 + fixture.realRows = false;
137 });
138
139 function render(links: ReadonlyArray<ThreadPullRequestLink>, current: ThreadPullRequestLink) {
@@ -166,3 +227,58 @@ it("lets only watched pull requests stop their watch", () => {
227 },
228 });
229 });
230 +
231 +it("keeps workspace controls after expanding and collapsing 70 linked pull requests", async () => {
232 + fixture.realRows = true;
233 + container.style.cssText = "position:relative;width:1800px;height:500px";
234 + await act(async () => {
235 + root.render(
236 + <ThreadDetailsPanel
237 + {...threadRef}
238 + anchor={{ current: null }}
239 + handle={PopoverCreateHandle()}
240 + onPresentationChange={vi.fn()}
241 + activeProjectName={undefined}
242 + activeProjectScripts={undefined}
243 + preferredScriptId={null}
244 + keybindings={[]}
245 + availableEditors={[]}
246 + showOpenInPicker
247 + gitCwd="/tmp/project"
248 + isGitRepo
249 + envLocked={false}
250 + availableEnvironments={[]}
251 + onEnvironmentChange={vi.fn()}
252 + onEnvModeChange={vi.fn()}
253 + envMode="local"
254 + startFromOrigin={false}
255 + onStartFromOriginChange={vi.fn()}
256 + onComposerFocusRequest={vi.fn()}
257 + onRunProjectScript={vi.fn()}
258 + onAddProjectScript={vi.fn()}
259 + onUpdateProjectScript={vi.fn()}
260 + onDeleteProjectScript={vi.fn()}
261 + />,
262 + );
263 + });
264 + const runContext = page.getByRole("button", { name: "Run context" });
265 + const editor = page.getByRole("group", { name: "Open in editor" });
266 + await expect.element(runContext).toBeVisible();
267 + await expect.element(editor).toBeVisible();
268 +
269 + await userEvent.click(page.getByRole("button", { name: "Show 69 more" }));
270 + await expect.element(page.getByRole("button", { name: "Show less" })).toBeInTheDocument();
271 + const extraRows = () =>
272 + container.querySelectorAll('[aria-label^="https://github.com/pingdotgg/t3code/pull/"]');
273 + expect(extraRows()).toHaveLength(69);
274 + // Let native ResizeObserver deliver the expanded content size before collapsing it.
275 + await act(async () => {
276 + await new Promise((resolve) => requestAnimationFrame(() => requestAnimationFrame(resolve)));
277 + });
278 + await userEvent.click(page.getByRole("button", { name: "Show less" }));
279 + await expect.element(page.getByRole("button", { name: "Show 69 more" })).toBeVisible();
280 + expect(extraRows()).toHaveLength(0);
281 + await expect.element(page.getByRole("button", { name: "Open pull request #1" })).toBeVisible();
282 + await expect.element(runContext).toBeVisible();
283 + await expect.element(editor).toBeVisible();
284 +});
apps/web/src/components/chat/ThreadDetailsPrRows.tsx
+6 -4
@@ -101,8 +101,9 @@ export function ThreadDetailsPrRows({
101 return (
102 <>
103 {currentRow}
104 - {expanded
105 - ? rest.map((link) => (
104 + {expanded ? (
105 + <div data-thread-details-pr-list className="flex flex-col">
106 + {rest.map((link) => (
107 <ThreadDetailsPrLinkRow
108 key={threadPullRequestKeyOf(link)}
109 environmentId={row.environmentId}
@@ -111,8 +112,9 @@ export function ThreadDetailsPrRows({
112 onActed={row.onActed}
113 onStopWatching={stopWatching(link)}
114 />
114 - ))
115 - : null}
115 + ))}
116 + </div>
117 + ) : null}
118 <ThreadDetailsControl
119 variant="ghost"
120 size="sm"