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, 06:00 UTC
fix(web): collapse extra linked issues in thread details (#39232)
Bilal Bakr committed
Nov 19, 2026 at 23:51 UTC
b111b6310ab55011e3500172377a770123c7b655
4 files changed
+96
-53
apps/web/src/components/chat/ThreadDetailsControl.tsx
+33
-1
@@ -1,5 +1,6 @@
1
import { mergeProps } from "@base-ui/react/merge-props";
2
import { useRender } from "@base-ui/react/use-render";
3
+import { T, Var } from "gt-react";
4
import type { ComponentProps } from "react";
5
6
import { cn } from "~/lib/utils";
@@ -15,7 +16,7 @@ import {
16
THREAD_DETAILS_PANEL_SELECT_LABEL_CLASS,
17
THREAD_DETAILS_PANEL_SELECT_ICON_CLASS,
18
} from "./threadDetailsPanelStyles";
18
-import { ChevronDownIcon } from "lucide-react";
19
+import { ChevronDownIcon, ChevronUpIcon } from "lucide-react";
20
21
const parts = {
22
row: THREAD_DETAILS_PANEL_ROW_CLASS,
@@ -107,3 +108,34 @@ export function ThreadDetailsControl({
108
}
109
return control;
110
}
111
+
112
+export function ThreadDetailsMoreButton({
113
+ expanded,
114
+ remaining,
115
+ onToggle,
116
+}: {
117
+ expanded: boolean;
118
+ remaining: number;
119
+ onToggle: () => void;
120
+}) {
121
+ const Icon = expanded ? ChevronUpIcon : ChevronDownIcon;
122
+ return (
123
+ <ThreadDetailsControl
124
+ variant="ghost"
125
+ size="sm"
126
+ aria-expanded={expanded}
127
+ onClick={onToggle}
128
+ tone="muted"
129
+ className="w-full active:scale-100"
130
+ >
131
+ <Icon aria-hidden className="size-4 shrink-0" />
132
+ {expanded ? (
133
+ <T>Show less</T>
134
+ ) : (
135
+ <T>
136
+ Show <Var>{remaining}</Var> more
137
+ </T>
138
+ )}
139
+ </ThreadDetailsControl>
140
+ );
141
+}
apps/web/src/components/chat/ThreadDetailsIssueRows.tsx
+29
-12
@@ -1,7 +1,8 @@
1
import { threadIssueKeyOf, type ScopedThreadRef, type ThreadIssueLink } from "@t3tools/contracts";
2
+import { scopedThreadKey } from "@t3tools/client-runtime/environment";
3
import { useGT } from "gt-react";
4
import { MessageSquareIcon } from "lucide-react";
4
-import type { MouseEvent } from "react";
5
+import { useState, type MouseEvent } from "react";
6
7
import { cn } from "~/lib/utils";
8
import { useRightPanelStore } from "~/rightPanelStore";
@@ -19,7 +20,7 @@ import {
20
PullRequestRowLines,
21
} from "../pullRequest/PullRequestListRow";
22
import { PullRequestActorLabel } from "../pullRequest/pullRequestPresentation";
22
-import { ThreadDetailsControl } from "./ThreadDetailsControl";
23
+import { ThreadDetailsControl, ThreadDetailsMoreButton } from "./ThreadDetailsControl";
24
import { Tooltip, TooltipPopup, TooltipTrigger } from "../ui/tooltip";
25
26
function LinkedIssueRow({
@@ -156,14 +157,30 @@ export function ThreadDetailsIssueRows({
157
mountScope?: "thread-details" | "linked-items" | "sidebar-tooltip";
158
onOpen?: () => void;
159
}) {
159
- return links.map((link) => (
160
- <LinkedIssueRow
161
- key={threadIssueKeyOf(link)}
162
- link={link}
163
- threadRef={threadRef}
164
- compact={compact}
165
- mountScope={mountScope}
166
- onOpen={onOpen}
167
- />
168
- ));
160
+ const [expandedThread, setExpandedThread] = useState<string | null>(null);
161
+ const threadKey = scopedThreadKey(threadRef);
162
+ const expanded = expandedThread === threadKey;
163
+ const hasMore = compact && links.length > 1;
164
+ const visibleLinks = hasMore && !expanded ? links.slice(0, 1) : links;
165
+ return (
166
+ <>
167
+ {visibleLinks.map((link) => (
168
+ <LinkedIssueRow
169
+ key={threadIssueKeyOf(link)}
170
+ link={link}
171
+ threadRef={threadRef}
172
+ compact={compact}
173
+ mountScope={mountScope}
174
+ onOpen={onOpen}
175
+ />
176
+ ))}
177
+ {hasMore ? (
178
+ <ThreadDetailsMoreButton
179
+ expanded={expanded}
180
+ remaining={links.length - 1}
181
+ onToggle={() => setExpandedThread(expanded ? null : threadKey)}
182
+ />
183
+ ) : null}
184
+ </>
185
+ );
186
}
apps/web/src/components/chat/ThreadDetailsPrRow.browser.test.tsx
+27
-15
@@ -8,6 +8,7 @@ import {
8
ThreadId,
9
type PullRequestCheck,
10
type ScopedThreadRef,
11
+ type ThreadIssueLink,
12
} from "@t3tools/contracts";
13
import { DraftId } from "~/composerDraftStore";
14
import { AsyncResult } from "effect/reactivity";
@@ -387,29 +388,34 @@ it("names a linked pull request row by its kind, number and title, not its URL",
388
expect(exposedNumbers).toHaveLength(0);
389
});
390
390
-it("names a linked issue row by its kind, number and title, not its URL", async () => {
391
+it("names the first linked issue and reveals more issues on demand", async () => {
392
await using screen = await setup();
393
+ const issue: ThreadIssueLink = {
394
+ tracker: IssueTrackerKind.make("github"),
395
+ host: "github.com",
396
+ scope: "owner/repo",
397
+ key: "123",
398
+ projectId: ProjectId.make("repository"),
399
+ url: "https://github.com/owner/repo/issues/123",
400
+ source: "manual",
401
+ linkedAt: "2026-10-30T00:00:00.000Z",
402
+ displayKey: "#123",
403
+ title: "Sidebar flickers on resize",
404
+ };
405
await act(async () => {
406
await screen.rerender(
407
<ThreadDetailsIssueRows
408
links={[
409
+ issue,
410
{
397
- tracker: IssueTrackerKind.make("github"),
398
- host: "github.com",
399
- scope: "owner/repo",
400
- key: "123",
401
- projectId: ProjectId.make("repository"),
402
- url: "https://github.com/owner/repo/issues/123",
403
- source: "manual",
404
- linkedAt: "2026-10-30T00:00:00.000Z",
405
- displayKey: "#123",
406
- title: "Sidebar flickers on resize",
411
+ ...issue,
412
+ key: "124",
413
+ displayKey: "#124",
414
+ url: "https://github.com/owner/repo/issues/124",
415
+ title: "Tab list jumps",
416
},
417
]}
409
- threadRef={{
410
- environmentId: EnvironmentId.make("environment"),
411
- threadId: ThreadId.make("thread"),
412
- }}
418
+ threadRef={threadRef}
419
/>,
420
);
421
});
@@ -433,6 +439,12 @@ it("names a linked issue row by its kind, number and title, not its URL", async
439
row.dispatchEvent(externalClick);
440
});
441
expect(externalClick.defaultPrevented).toBe(false);
442
+ const extra = screen.getByRole("link", { name: "Issue #124: Tab list jumps" });
443
+ await expect.element(extra).not.toBeInTheDocument();
444
+ await screen.getByRole("button", { name: "Show 1 more" }).click();
445
+ await expect.element(extra).toBeVisible();
446
+ await screen.getByRole("button", { name: "Show less" }).click();
447
+ await expect.element(extra).not.toBeInTheDocument();
448
});
449
450
it("keeps Ready pending when refreshed detail becomes mergeable before the action settles", async () => {
apps/web/src/components/chat/ThreadDetailsPrRows.tsx
+7
-25
@@ -1,5 +1,5 @@
1
import { pipe } from "effect/Function";
2
-import { ThreadDetailsControl } from "./ThreadDetailsControl";
2
+import { ThreadDetailsMoreButton } from "./ThreadDetailsControl";
3
import type {
4
EnvironmentId,
5
ScopedThreadRef,
@@ -13,8 +13,7 @@ import {
13
threadPullRequestKeyOf,
14
visibleThreadPullRequests,
15
} from "@t3tools/client-runtime/thread-pull-requests";
16
-import { T, useMessages, Var } from "gt-react";
17
-import { ChevronDownIcon, ChevronUpIcon } from "lucide-react";
16
+import { useMessages } from "gt-react";
17
import { useState, type ComponentProps, type MouseEvent as ReactMouseEvent } from "react";
18
19
import { sourceControlClients } from "@t3tools/client-runtime/source-control-clients";
@@ -136,28 +135,11 @@ function ThreadDetailsPrRows({
135
))}
136
</div>
137
) : null}
139
- <ThreadDetailsControl
140
- variant="ghost"
141
- size="sm"
142
- onClick={() => setExpanded(!expanded)}
143
- part="row"
144
- tone="muted"
145
- className="w-full active:scale-100"
146
- >
147
- {/* Chevrons, not plus and minus: the plus already means "add" in this card. */}
148
- {expanded ? (
149
- <ChevronUpIcon aria-hidden className="size-4 shrink-0" />
150
- ) : (
151
- <ChevronDownIcon aria-hidden className="size-4 shrink-0" />
152
- )}
153
- {expanded ? (
154
- <T>Show less</T>
155
- ) : (
156
- <T>
157
- Show <Var>{rest.length}</Var> more
158
- </T>
159
- )}
160
- </ThreadDetailsControl>
138
+ <ThreadDetailsMoreButton
139
+ expanded={expanded}
140
+ remaining={rest.length}
141
+ onToggle={() => setExpanded(!expanded)}
142
+ />
143
</>
144
);
145
}