From e6875a53dd597a82674320ecde8631778d085fe1 Mon Sep 17 00:00:00 2001 From: Thomas Molinari Date: Wed, 25 Nov 2026 22:35:43 +1100 Subject: [PATCH 1/2] fix(web): expanding linked issues no longer hides thread details sections --- .../chat/ThreadDetailsCard.browser.test.tsx | 16 ++++ .../src/components/chat/ThreadDetailsCard.tsx | 6 +- .../chat/ThreadDetailsIssueRows.tsx | 61 +++++++++---- .../chat/ThreadDetailsPrRow.browser.test.tsx | 90 +++++++++++++++++++ 4 files changed, 153 insertions(+), 20 deletions(-) diff --git a/apps/web/src/components/chat/ThreadDetailsCard.browser.test.tsx b/apps/web/src/components/chat/ThreadDetailsCard.browser.test.tsx index e234686d6ff0..b03b58e10f4e 100644 --- a/apps/web/src/components/chat/ThreadDetailsCard.browser.test.tsx +++ b/apps/web/src/components/chat/ThreadDetailsCard.browser.test.tsx @@ -45,6 +45,7 @@ function Card({ rows = 1, automationRows = 0, serverOverflowRows = 0, + issueListRows = 0, }: { threadRef: ScopedThreadRef; inline: boolean; @@ -55,6 +56,8 @@ function Card({ automationRows?: number; /** Rows of 100px that expanded server lists add, which density ignores. */ serverOverflowRows?: number; + /** Rows of 100px that expanded linked issues add, which density ignores. */ + issueListRows?: number; }) { return ( // The web root renders in StrictMode, which re-runs ref callbacks on every mount. @@ -92,6 +95,9 @@ function Card({ style={{ height: serverOverflowRows * 100 }} /> ) : null} + {issueListRows > 0 ? ( +
+ ) : null} )} @@ -196,3 +202,13 @@ it("stays full while expanded server rows overflow", async () => { .element(page.getByRole("region", { name: "Thread details" })) .toHaveAttribute("data-density", "full"); }); + +it("stays full while expanded issue rows overflow", async () => { + using fixture = setup(); + await using _screen = await render( + , + ); + await expect + .element(page.getByRole("region", { name: "Thread details" })) + .toHaveAttribute("data-density", "full"); +}); diff --git a/apps/web/src/components/chat/ThreadDetailsCard.tsx b/apps/web/src/components/chat/ThreadDetailsCard.tsx index 9959dbe2dc41..aadb47d0724c 100644 --- a/apps/web/src/components/chat/ThreadDetailsCard.tsx +++ b/apps/web/src/components/chat/ThreadDetailsCard.tsx @@ -80,10 +80,10 @@ export function ThreadDetailsCard({ const measure = () => { const frame = element.closest("[data-thread-details-card]"); const next = element.offsetHeight + (frame ? frame.offsetHeight - frame.clientHeight : 0); - // PR lists, servers, lineage, side chats and automations scroll as they grow. Counting them - // toward density would hide the section and workspace controls when the user asks to see more. + // PR and issue lists, servers, lineage, side chats and automations scroll as they grow. + // Counting them toward density would hide the section and workspace controls when the user asks to see more. const lists = element.querySelectorAll( - "[data-thread-relationships-panel], [data-thread-side-chats-panel], [data-thread-details-pr-list], [data-thread-automations-panel], [data-thread-details-server-overflow]", + "[data-thread-relationships-panel], [data-thread-side-chats-panel], [data-thread-details-pr-list], [data-thread-details-issue-list], [data-thread-automations-panel], [data-thread-details-server-overflow]", ); const fittingHeight = next - Array.from(lists).reduce((sum, list) => sum + list.offsetHeight, 0); diff --git a/apps/web/src/components/chat/ThreadDetailsIssueRows.tsx b/apps/web/src/components/chat/ThreadDetailsIssueRows.tsx index 5726d1edeca1..e26da78faa52 100644 --- a/apps/web/src/components/chat/ThreadDetailsIssueRows.tsx +++ b/apps/web/src/components/chat/ThreadDetailsIssueRows.tsx @@ -161,26 +161,53 @@ export function ThreadDetailsIssueRows({ const threadKey = scopedThreadKey(threadRef); const expanded = expandedThread === threadKey; const hasMore = compact && links.length > 1; - const visibleLinks = hasMore && !expanded ? links.slice(0, 1) : links; + const [firstLink, ...restLinks] = links; + if (firstLink === undefined) return null; + if (!hasMore) { + return ( + <> + {links.map((link) => ( + + ))} + + ); + } return ( <> - {visibleLinks.map((link) => ( - - ))} - {hasMore ? ( - setExpandedThread(expanded ? null : threadKey)} - /> + + {expanded ? ( +
+ {restLinks.map((link) => ( + + ))} +
) : null} + setExpandedThread(expanded ? null : threadKey)} + /> ); } diff --git a/apps/web/src/components/chat/ThreadDetailsPrRow.browser.test.tsx b/apps/web/src/components/chat/ThreadDetailsPrRow.browser.test.tsx index 666bbccd1368..82c03ceaf1ca 100644 --- a/apps/web/src/components/chat/ThreadDetailsPrRow.browser.test.tsx +++ b/apps/web/src/components/chat/ThreadDetailsPrRow.browser.test.tsx @@ -1,3 +1,4 @@ +import "~/index.css"; import { ThreadDetailsIssueRows } from "./ThreadDetailsIssueRows"; import type { EnvironmentProject } from "@t3tools/client-runtime/state/shell"; import { @@ -130,7 +131,12 @@ vi.mock(import("../ui/toast"), async (original) => { import { act, render as renderUi } from "../../../test/render"; import { useComposerDraftStore } from "~/composerDraftStore"; +import { useRightPanelStore } from "~/rightPanelStore"; import { useUiStateStore } from "~/uiStateStore"; +import { PopoverCreateHandle } from "../ui/popover"; +import { ChatCanvasContext } from "./ChatCanvasContext"; +import { resolveChatCanvasLayout } from "./chatCanvasLayout"; +import { ThreadDetailsCard } from "./ThreadDetailsCard"; import { ThreadDetailsPrRow } from "./ThreadDetailsPrRow"; import { ThreadDetailsThreadPrRows } from "./ThreadDetailsPrRows"; @@ -459,6 +465,90 @@ it("names the first linked issue and reveals more issues on demand", async () => await expect.element(extra).not.toBeInTheDocument(); }); +it("keeps full density and Lineage visible when expanding and collapsing linked issues", async () => { + await using screen = await setup(); + useRightPanelStore.setState({ threadPanelVisibilityByThreadKey: {} }); + const container = { width: 1200, height: 800 }; + const placement = { x: 908, y: 0, right: 12, width: 280, height: 400 } as const; + const anchor = document.createElement("div"); + document.body.append(anchor); + const measureDetailsCard = vi.fn(); + const issues: ReadonlyArray = Array.from({ length: 7 }, (_, index) => { + const number = 56 + index; + return { + tracker: IssueTrackerKind.make("github"), + host: "github.com", + scope: "owner/repo", + key: String(number), + projectId: ProjectId.make("repository"), + url: `https://github.com/owner/repo/issues/${number}`, + source: "manual", + linkedAt: "2026-10-30T00:00:00.000Z", + displayKey: `#${number}`, + title: `Linked issue ${number} with enough text to wrap across two lines`, + }; + }); + try { + await act(async () => { + await screen.rerender( + {}, + measureDetailsCard, + detailsCardTopInset: 0, + preferredDetailsCard: placement, + detailsCardPlacement: placement, + }} + > + + {(density) => ( +
+
Workspace controls
+ + {density === "full" ? ( +
Lineage · 6 running
+ ) : null} +
+ )} +
+
, + ); + }); + + const card = screen.getByRole("region", { name: "Thread details" }); + const lineage = screen.getByText("Lineage · 6 running"); + await expect.element(card).toHaveAttribute("data-density", "full"); + await expect.element(lineage).toBeVisible(); + + await screen.getByRole("button", { name: "Show 6 more" }).click(); + await expect.element(screen.getByRole("button", { name: "Show less" })).toBeInTheDocument(); + await vi.waitFor(() => { + const lastCall = measureDetailsCard.mock.lastCall?.[0] as + | { fullContentHeight: number } + | undefined; + expect(lastCall?.fullContentHeight ?? 0).toBeGreaterThan(placement.height); + }); + await expect.element(card).toHaveAttribute("data-density", "full"); + await expect.element(lineage).toBeInTheDocument(); + + await screen.getByRole("button", { name: "Show less" }).click(); + await expect.element(screen.getByRole("button", { name: "Show 6 more" })).toBeVisible(); + await expect.element(card).toHaveAttribute("data-density", "full"); + await expect.element(lineage).toBeVisible(); + } finally { + anchor.remove(); + } +}); + it("keeps Ready pending when refreshed detail becomes mergeable before the action settles", async () => { await using screen = await setup(); const row = () => ( From 2af816c979ec56e68dbaf32d7c94f3035ef6066d Mon Sep 17 00:00:00 2001 From: Julius Marminge Date: Wed, 25 Nov 2026 11:43:56 +0000 Subject: [PATCH 2/2] refactor(web): share the linked issue row render and trim density coverage Co-Authored-By: Claude Opus 5.5 --- .../chat/ThreadDetailsIssueRows.tsx | 53 +++-------- .../chat/ThreadDetailsPrRow.browser.test.tsx | 92 +------------------ 2 files changed, 17 insertions(+), 128 deletions(-) diff --git a/apps/web/src/components/chat/ThreadDetailsIssueRows.tsx b/apps/web/src/components/chat/ThreadDetailsIssueRows.tsx index e26da78faa52..36776560c594 100644 --- a/apps/web/src/components/chat/ThreadDetailsIssueRows.tsx +++ b/apps/web/src/components/chat/ThreadDetailsIssueRows.tsx @@ -160,52 +160,29 @@ export function ThreadDetailsIssueRows({ const [expandedThread, setExpandedThread] = useState(null); const threadKey = scopedThreadKey(threadRef); const expanded = expandedThread === threadKey; - const hasMore = compact && links.length > 1; - const [firstLink, ...restLinks] = links; - if (firstLink === undefined) return null; - if (!hasMore) { - return ( - <> - {links.map((link) => ( - - ))} - - ); - } + const row = (link: ThreadIssueLink) => ( + + ); + const [first, ...rest] = links; + if (first === undefined || !compact || rest.length === 0) return <>{links.map(row)}; return ( <> - + {row(first)} {expanded ? (
- {restLinks.map((link) => ( - - ))} + {rest.map(row)}
) : null} setExpandedThread(expanded ? null : threadKey)} /> diff --git a/apps/web/src/components/chat/ThreadDetailsPrRow.browser.test.tsx b/apps/web/src/components/chat/ThreadDetailsPrRow.browser.test.tsx index 82c03ceaf1ca..d58a084f4bf6 100644 --- a/apps/web/src/components/chat/ThreadDetailsPrRow.browser.test.tsx +++ b/apps/web/src/components/chat/ThreadDetailsPrRow.browser.test.tsx @@ -1,4 +1,3 @@ -import "~/index.css"; import { ThreadDetailsIssueRows } from "./ThreadDetailsIssueRows"; import type { EnvironmentProject } from "@t3tools/client-runtime/state/shell"; import { @@ -131,12 +130,7 @@ vi.mock(import("../ui/toast"), async (original) => { import { act, render as renderUi } from "../../../test/render"; import { useComposerDraftStore } from "~/composerDraftStore"; -import { useRightPanelStore } from "~/rightPanelStore"; import { useUiStateStore } from "~/uiStateStore"; -import { PopoverCreateHandle } from "../ui/popover"; -import { ChatCanvasContext } from "./ChatCanvasContext"; -import { resolveChatCanvasLayout } from "./chatCanvasLayout"; -import { ThreadDetailsCard } from "./ThreadDetailsCard"; import { ThreadDetailsPrRow } from "./ThreadDetailsPrRow"; import { ThreadDetailsThreadPrRows } from "./ThreadDetailsPrRows"; @@ -461,94 +455,12 @@ it("names the first linked issue and reveals more issues on demand", async () => await expect.element(extra).not.toBeInTheDocument(); await screen.getByRole("button", { name: "Show 1 more" }).click(); await expect.element(extra).toBeVisible(); + // The details card leaves this list out of its density measurement. + expect(extra.element().closest("[data-thread-details-issue-list]")).not.toBeNull(); await screen.getByRole("button", { name: "Show less" }).click(); await expect.element(extra).not.toBeInTheDocument(); }); -it("keeps full density and Lineage visible when expanding and collapsing linked issues", async () => { - await using screen = await setup(); - useRightPanelStore.setState({ threadPanelVisibilityByThreadKey: {} }); - const container = { width: 1200, height: 800 }; - const placement = { x: 908, y: 0, right: 12, width: 280, height: 400 } as const; - const anchor = document.createElement("div"); - document.body.append(anchor); - const measureDetailsCard = vi.fn(); - const issues: ReadonlyArray = Array.from({ length: 7 }, (_, index) => { - const number = 56 + index; - return { - tracker: IssueTrackerKind.make("github"), - host: "github.com", - scope: "owner/repo", - key: String(number), - projectId: ProjectId.make("repository"), - url: `https://github.com/owner/repo/issues/${number}`, - source: "manual", - linkedAt: "2026-10-30T00:00:00.000Z", - displayKey: `#${number}`, - title: `Linked issue ${number} with enough text to wrap across two lines`, - }; - }); - try { - await act(async () => { - await screen.rerender( - {}, - measureDetailsCard, - detailsCardTopInset: 0, - preferredDetailsCard: placement, - detailsCardPlacement: placement, - }} - > - - {(density) => ( -
-
Workspace controls
- - {density === "full" ? ( -
Lineage · 6 running
- ) : null} -
- )} -
-
, - ); - }); - - const card = screen.getByRole("region", { name: "Thread details" }); - const lineage = screen.getByText("Lineage · 6 running"); - await expect.element(card).toHaveAttribute("data-density", "full"); - await expect.element(lineage).toBeVisible(); - - await screen.getByRole("button", { name: "Show 6 more" }).click(); - await expect.element(screen.getByRole("button", { name: "Show less" })).toBeInTheDocument(); - await vi.waitFor(() => { - const lastCall = measureDetailsCard.mock.lastCall?.[0] as - | { fullContentHeight: number } - | undefined; - expect(lastCall?.fullContentHeight ?? 0).toBeGreaterThan(placement.height); - }); - await expect.element(card).toHaveAttribute("data-density", "full"); - await expect.element(lineage).toBeInTheDocument(); - - await screen.getByRole("button", { name: "Show less" }).click(); - await expect.element(screen.getByRole("button", { name: "Show 6 more" })).toBeVisible(); - await expect.element(card).toHaveAttribute("data-density", "full"); - await expect.element(lineage).toBeVisible(); - } finally { - anchor.remove(); - } -}); - it("keeps Ready pending when refreshed detail becomes mergeable before the action settles", async () => { await using screen = await setup(); const row = () => (