Shared task board where people and AI coding agents work as teammates. Source-available, self-hostable.
Go
fix(views): stop the PR row diff from overlapping the number in a narrow sidebar (MUL-10154) (#11528)
Bohan Jiang9b4e7a95e599
diff --git a/packages/views/issues/components/pull-request-list.test.tsx b/packages/views/issues/components/pull-request-list.test.tsxindex 0f0f5c7c76..2b548361f7 100644--- a/packages/views/issues/components/pull-request-list.test.tsx+++ b/packages/views/issues/components/pull-request-list.test.tsx@@ -375,6 +375,28 @@ describe("PullRequestList sidebar rows", () => {expect(screen.getByTestId("pull-request-row")).not.toHaveTextContent("119 files");});+ it("lets the diff wrap away on its own instead of squeezing the number", async () => {+ // Nested in the number's shrinkable group, a narrow row drew the diff+ // over the number; as a sibling it wraps whole onto the clipped line.+ mockPRs = [makePR({ number: 11590, additions: 500, deletions: 22 })];+ renderList();+ await waitForRender();+ const line = screen.getByTestId("pull-request-diff").parentElement!;+ expect(line).toHaveClass("flex-wrap", "overflow-hidden");+ expect(screen.getByText("#11590").parentElement).toBe(line);+ });++ it("gives the repo name only leftover room, so it truncates before the diff wraps", async () => {+ mockPRs = [+ makePR({ id: "a", number: 42, additions: 5, deletions: 1 }),+ makePR({ id: "b", number: 7, repo_name: "gadget" }),+ ];+ renderList();+ await waitForRender();+ expect(screen.getByText("widget")).toHaveClass("basis-0", "grow", "max-w-fit", "truncate");+ expect(screen.getByText("widget").parentElement).toBe(screen.getByTestId("pull-request-diff").parentElement);+ });+it.each([["checks are running", { checks_rollup: "pending" as const, checks_total: 4, checks_running: 2 }],["the snapshot is stale", { snapshot_stale: true, snapshot_fetched_at: new Date(Date.now() - 3_600_000).toISOString() }],diff --git a/packages/views/issues/components/pull-request-list.tsx b/packages/views/issues/components/pull-request-list.tsxindex 7754e76b9a..f4131eee27 100644--- a/packages/views/issues/components/pull-request-list.tsx+++ b/packages/views/issues/components/pull-request-list.tsx@@ -451,28 +451,29 @@ function PullRequestRow({{stripIssueKeyFromTitle(pr.title, identifier)}</p><div className="mt-1 flex items-center gap-2">- {/* The number, the diff and the pill never yield; short of room,- only the repo name truncates. The trailing meta is one unit:- it wraps whole onto the clipped second line instead of being- cut mid-word. */}+ {/* The number and the pill never yield. The diff and the trailing+ meta are each one unit: short of room, they wrap whole onto+ the clipped second line (the tooltip keeps them) instead of+ being cut mid-word or drawn over the number. The repo name+ takes no room of its own (zero basis), only what is left+ over, so it truncates before the diff wraps; its negative+ margin cancels the gap so it reads `repo#number`. */}<p className="flex h-lh min-w-0 flex-1 flex-wrap items-center gap-x-1.5 overflow-hidden whitespace-nowrap text-caption text-muted-foreground tabular-nums">- <span className="inline-flex min-w-0 items-center gap-1.5">- <span className="inline-flex min-w-0 items-center">- {showRepo ? <span className="min-w-0 truncate">{pr.repo_name}</span> : null}- <span className="shrink-0">#{pr.number}</span>- </span>- {showStats ? (- <span data-testid="pull-request-diff" className="inline-flex shrink-0 items-center gap-1.5">- <span aria-hidden="true" className="text-faint-foreground">- ·- </span>- <span className="inline-flex items-center gap-1">- <span className="text-success">+{formatPullRequestDiffCount(pr.additions ?? 0)}</span>- <span className="text-destructive">−{formatPullRequestDiffCount(pr.deletions ?? 0)}</span>- </span>+ {showRepo ? (+ <span className="-me-1.5 min-w-0 max-w-fit grow basis-0 truncate">{pr.repo_name}</span>+ ) : null}+ <span className="shrink-0">#{pr.number}</span>+ {showStats ? (+ <span data-testid="pull-request-diff" className="inline-flex shrink-0 items-center gap-1.5">+ <span aria-hidden="true" className="text-faint-foreground">+ ·</span>- ) : null}- </span>+ <span className="inline-flex items-center gap-1">+ <span className="text-success">+{formatPullRequestDiffCount(pr.additions ?? 0)}</span>+ <span className="text-destructive">−{formatPullRequestDiffCount(pr.deletions ?? 0)}</span>+ </span>+ </span>+ ) : null}{meta ? (<span className="inline-flex min-w-0 items-center gap-1.5"><span aria-hidden="true" className="text-faint-foreground">