The best way to control Claude Code, Codex and more from any computer or phone
fix(web): show status for grouped sidebar issues (#39351)
Bilal Bakr committed
Nov 20, 2026 at 04:03 UTC
29b42d409caca461740d8b661b18b4314d080495
3 files changed
+75
-20
apps/web/src/components/ChatView.browser.test.tsx
+24
-5
@@ -139,15 +139,30 @@ it("opens a linked Linear issue from an inactive thread's sidebar badge", async
139
displayKey: issueRef.key,
140
title: "Add keyboard support",
141
};
142
- using _environment = installFakeEnvironment([first, { ...linked, issues: [issue] }]);
142
+ const completed = {
143
+ ...issue,
144
+ key: "WEB-124",
145
+ displayKey: "WEB-124",
146
+ url: "https://linear.app/example/issue/WEB-124/keep-tabs-visible",
147
+ title: "Keep tabs visible",
148
+ };
149
+ const grouped = threadWithHistory("issue-grouped", 1);
150
+ using _environment = installFakeEnvironment([
151
+ first,
152
+ { ...linked, issues: [issue] },
153
+ { ...grouped, issues: [completed, issue] },
154
+ ]);
155
const liveTitle = "Add keyboard shortcuts to the sidebar";
156
using _detail = answerRpc(WS_METHODS.issuesDetail, (input: IssueRef) => {
145
- expect(input).toEqual(issueRef);
157
+ const isCompleted = input.key === completed.key;
158
+ expect(input).toEqual({ ...issueRef, key: isCompleted ? completed.key : issue.key });
159
return Effect.succeed({
147
- ...issue,
148
- title: liveTitle,
160
+ ...(isCompleted ? completed : issue),
161
+ title: isCompleted ? completed.title : liveTitle,
162
author: { login: "sam", name: null, avatarUrl: null },
150
- state: { category: "open", name: "Open" },
163
+ state: isCompleted
164
+ ? { category: "closed", closeReason: "completed", name: "Done" }
165
+ : { category: "open", name: "Open" },
166
createdAt: issue.linkedAt,
167
updatedAt: issue.linkedAt,
168
closedAt: null,
@@ -202,6 +217,10 @@ it("opens a linked Linear issue from an inactive thread's sidebar badge", async
217
});
218
await expect.element(badge).toBeVisible();
219
expect(badge.element().querySelector("svg")).toHaveClass(/text-emerald-600/);
220
+ const groupedBadge = page.getByRole("button", { name: "2 linked issues" });
221
+ await vi.waitFor(() =>
222
+ expect(groupedBadge.element().querySelector("svg")).toHaveClass(/text-emerald-600/),
223
+ );
224
await userEvent.hover(badge);
225
const issueName = `Issue ${issue.displayKey}: ${liveTitle}`;
226
const previewLink = page.getByRole("link", { name: issueName });
apps/web/src/components/sidebar/SidebarThreadRow.tsx
+4
-5
@@ -78,7 +78,7 @@ import { useThreadSelectionStore } from "../../threadSelectionStore";
78
import { useNowMinute } from "../../hooks/useNowMinute";
79
import { useNowSecond } from "../../hooks/useNowSecond";
80
import { vcsEnvironment, vcsBranchRevalidation } from "../../state/vcs";
81
-import { useLinkedIssueDetail } from "../../state/issues";
81
+import { useSidebarLinkedIssueState } from "../../state/issues";
82
import { useEnvironmentQuery } from "../../state/query";
83
import { readEnvironmentScope, useEnvironmentScope } from "../../state/session";
84
import { formatRelativeTime, parseTimestampDate } from "../../timestampFormat";
@@ -1134,12 +1134,11 @@ const SidebarThreadRow = memo(function SidebarThreadRow(props: SidebarThreadRowP
1134
) : null;
1135
const firstIssue = thread.issues?.[0];
1136
const issueCount = thread.issues?.length ?? 0;
1137
- const issueDetail = useLinkedIssueDetail(
1137
+ const issueState = useSidebarLinkedIssueState(
1138
thread.environmentId,
1139
- leaseLiveStatus && issueCount === 1 ? firstIssue : undefined,
1140
- "sidebar",
1139
+ leaseLiveStatus ? thread.issues : undefined,
1140
);
1142
- const issueStatus = issueDetail === null ? null : issueStatePresentation(issueDetail.state);
1141
+ const issueStatus = issueState === null ? null : issueStatePresentation(issueState);
1142
const IssueIcon = issueStatus?.Icon ?? IssueGlyph.issue;
1143
const issueLabel =
1144
issueCount === 1 && firstIssue
apps/web/src/state/issues.ts
+47
-10
@@ -7,7 +7,9 @@ import {
7
type MergedIssueList,
8
} from "@t3tools/client-runtime/state/issues";
9
import { useAtomValue } from "@effect/atom-react";
10
-import type { EnvironmentId, ThreadIssueLink } from "@t3tools/contracts";
10
+import { selectEnvironmentQueryData } from "@t3tools/client-runtime/state/runtime";
11
+import type { EnvironmentId, IssueState, ThreadIssueLink } from "@t3tools/contracts";
12
+import { Atom } from "effect/reactivity";
13
14
import { connectionAtomRuntime } from "../connection/runtime";
15
import { appAtomRegistry } from "../rpc/atomRegistry";
@@ -18,26 +20,61 @@ export type { IssueListTarget };
20
21
export const issueEnvironment = createIssueEnvironmentAtoms(connectionAtomRuntime);
22
23
+const linkedIssueRef = ({ projectId, tracker, host, scope, key }: ThreadIssueLink) => ({
24
+ projectId,
25
+ tracker,
26
+ host,
27
+ scope,
28
+ key,
29
+});
30
+
31
export function useLinkedIssueDetail(
32
environmentId: EnvironmentId,
33
link: ThreadIssueLink | undefined,
34
mountScope?: "sidebar" | "thread-details" | "linked-items" | "sidebar-tooltip",
35
) {
36
const configs = useServerConfigs();
27
- const input = link && {
28
- projectId: link.projectId,
29
- tracker: link.tracker,
30
- host: link.host,
31
- scope: link.scope,
32
- key: link.key,
33
- };
37
return useEnvironmentQuery(
35
- input && configs.get(environmentId)?.environment.capabilities.issues === true
36
- ? issueEnvironment.detail({ environmentId, input }, mountScope)
38
+ link && configs.get(environmentId)?.environment.capabilities.issues === true
39
+ ? issueEnvironment.detail({ environmentId, input: linkedIssueRef(link) }, mountScope)
40
: null,
41
).data;
42
}
43
44
+const emptySidebarIssueState = Atom.make<IssueState | null>(null);
45
+
46
+export function useSidebarLinkedIssueState(
47
+ environmentId: EnvironmentId,
48
+ links: ReadonlyArray<ThreadIssueLink> | undefined,
49
+) {
50
+ const configs = useServerConfigs();
51
+ const aggregate =
52
+ links?.length && configs.get(environmentId)?.environment.capabilities.issues === true
53
+ ? Atom.make((get): IssueState | null => {
54
+ const states = links.map(
55
+ (link) =>
56
+ selectEnvironmentQueryData(
57
+ get(
58
+ issueEnvironment.detail(
59
+ { environmentId, input: linkedIssueRef(link) },
60
+ "sidebar",
61
+ ),
62
+ ),
63
+ )?.state,
64
+ );
65
+ const open = states.find((state) => state?.category === "open");
66
+ if (open !== undefined) return open;
67
+ if (states.includes(undefined)) return null;
68
+ return (
69
+ states.find((state) => state?.closeReason && state.closeReason !== "completed") ??
70
+ states[0] ??
71
+ null
72
+ );
73
+ })
74
+ : emptySidebarIssueState;
75
+ return useAtomValue(aggregate);
76
+}
77
+
78
const mergedIssueLists = createMergedIssueListAtoms(issueEnvironment, formatEnvironmentQueryError);
79
80
/** The same listing read across every connected environment, as the pull-request page does. */