Shared task board where people and AI coding agents work as teammates. Source-available, self-hostable.
Go
fix(views): keep the PR row diff whole and spin the running-checks icon (MUL-7767) (#8900)
Jiayuan Zhang54987006b5ce
diff --git a/packages/views/issues/components/pull-request-list.test.tsx b/packages/views/issues/components/pull-request-list.test.tsxindex 5cebed6020..5088dc5640 100644--- a/packages/views/issues/components/pull-request-list.test.tsx+++ b/packages/views/issues/components/pull-request-list.test.tsx@@ -168,6 +168,24 @@ describe("PullRequestList sidebar rows", () => {await waitForRender();expect(verdict()).toHaveTextContent("5/7");expect(verdict()).toHaveAttribute("title", "5/7 · 2 running");+ expect(verdict().querySelector("svg")).toHaveClass("motion-safe:animate-spin");+ });++ it("stops the running spinner when the snapshot is stale", async () => {+ mockPRs = [+ makePR({+ checks_rollup: "pending",+ checks_total: 7,+ checks_passed: 5,+ checks_running: 2,+ snapshot_stale: true,+ snapshot_fetched_at: new Date(Date.now() - 2 * 3_600_000).toISOString(),+ }),+ ];+ renderList();+ await waitForRender();+ expect(verdict()).toHaveTextContent("5/7");+ expect(verdict().querySelector("svg")).not.toHaveClass("motion-safe:animate-spin");});it("calls a PR ready only when the merge state is clean", async () => {@@ -305,11 +323,24 @@ describe("PullRequestList sidebar rows", () => {expect(screen.getByText("MUL-2: unrelated work")).toBeInTheDocument();});- it("shows the repo and number without the owner", async () => {- mockPRs = [makePR({ number: 42 })];+ it("shows only the number when every PR is in one repo", async () => {+ mockPRs = [makePR({ id: "a", number: 42 }), makePR({ id: "b", number: 43 })];+ renderList();+ await waitForRender();+ expect(screen.getByText("#42")).toBeInTheDocument();+ expect(screen.getByText("#43")).toBeInTheDocument();+ expect(screen.queryByText("widget#42")).not.toBeInTheDocument();+ });++ it("shows the repo and number without the owner when the PRs span repos", async () => {+ mockPRs = [+ makePR({ id: "a", number: 42 }),+ makePR({ id: "b", number: 7, repo_name: "gadget" }),+ ];renderList();await waitForRender();expect(screen.getByText("widget#42")).toBeInTheDocument();+ expect(screen.getByText("gadget#7")).toBeInTheDocument();});it("hides the diff size when all stats are 0 (legacy backend)", async () => {diff --git a/packages/views/issues/components/pull-request-list.tsx b/packages/views/issues/components/pull-request-list.tsxindex 2db88501eb..31033f89f0 100644--- a/packages/views/issues/components/pull-request-list.tsx+++ b/packages/views/issues/components/pull-request-list.tsx@@ -105,17 +105,20 @@ export function PullRequestList({const useCollapse = prs.length >= PR_LIMIT_BEFORE_COLLAPSE;const expandedHead = useCollapse ? prs.slice(0, PR_LIMIT_BEFORE_COLLAPSE - 1) : prs;const collapsedTail = useCollapse ? prs.slice(PR_LIMIT_BEFORE_COLLAPSE - 1) : [];+ // The repo name only tells rows apart when the PRs span repos; otherwise it+ // spends the width the diff needs. The row tooltip keeps owner/repo#number.+ const showRepo = new Set(prs.map((pr) => `${pr.repo_owner}/${pr.repo_name}`)).size > 1;return (<div className="space-y-1">{expandedHead.map((pr) => (- <PullRequestRow key={pr.id} pr={pr} identifier={identifier} actions={rowActions} />+ <PullRequestRow key={pr.id} pr={pr} identifier={identifier} showRepo={showRepo} actions={rowActions} />))}{useCollapse ? (<div className="space-y-1">{expanded? collapsedTail.map((pr) => (- <PullRequestRow key={pr.id} pr={pr} identifier={identifier} actions={rowActions} />+ <PullRequestRow key={pr.id} pr={pr} identifier={identifier} showRepo={showRepo} actions={rowActions} />)): null}<button@@ -366,21 +369,25 @@ interface VerdictPillConfig {label: string;/** The longer form of the label, on hover. */title?: string;+ /** The icon spins while the work it reports is live. */+ spin?: boolean;}/**- * One PR in the sidebar: the title, then `repo#number` with the diff size and- * one verdict pill aligned right, so several PRs scan as a column. A failed PR- * also lists what failed. Owner, author, the full title and exact counts live- * in the row's tooltip.+ * One PR in the sidebar: the title, then `#number` (`repo#number` when the+ * list spans repos) with the diff size and one verdict pill aligned right, so+ * several PRs scan as a column. A failed PR also lists what failed. Owner,+ * author, the full title and exact counts live in the row's tooltip.*/function PullRequestRow({pr,identifier,+ showRepo,actions,}: {pr: GitHubPullRequest;identifier: string;+ showRepo: boolean;actions: RowActions | null;}) {const { t } = useT("issues");@@ -413,9 +420,8 @@ function PullRequestRow({</span>);} else if (showStats) {- // The diff yields first when the pill needs the room; repo#number never does.meta = (- <span className="min-w-0 overflow-hidden">+ <span><span className="text-emerald-600 dark:text-emerald-400">+{formatPullRequestDiffCount(pr.additions ?? 0)}</span>{" "}<span className="text-rose-600 dark:text-rose-400">−{formatPullRequestDiffCount(pr.deletions ?? 0)}</span></span>@@ -444,17 +450,20 @@ function PullRequestRow({{stripIssueKeyFromTitle(pr.title, identifier)}</p><div className="mt-1 flex items-center gap-2">- <p className="flex min-w-0 items-center gap-1.5 whitespace-nowrap text-micro text-muted-foreground tabular-nums">- <span className="shrink-0">- {pr.repo_name}#{pr.number}+ {/* The number and the pill never yield. Everything after the dot+ is one unit: short of room, it wraps whole onto the clipped+ second line instead of being cut mid-number (+312 → +31). */}+ <p className="flex h-lh min-w-0 flex-1 flex-wrap items-center gap-x-1.5 overflow-hidden whitespace-nowrap text-micro text-muted-foreground tabular-nums">+ <span className="min-w-0 truncate">+ {showRepo ? pr.repo_name : null}#{pr.number}</span>{meta ? (- <>- <span aria-hidden="true" className="shrink-0 text-faint-foreground">+ <span className="inline-flex min-w-0 items-center gap-1.5">+ <span aria-hidden="true" className="text-faint-foreground">·</span>{meta}- </>+ </span>) : null}</p>{pill ? <VerdictPill pill={pill} stale={stale} title={staleTitle} /> : null}@@ -493,7 +502,8 @@ function VerdictPill({ pill, stale, title }: { pill: VerdictPillConfig; stale: bstale ? "opacity-60" : null,)}>- <Icon className="size-3 shrink-0" />+ {/* A stale snapshot can't vouch that the checks are still running. */}+ <Icon className={cn("size-3 shrink-0", pill.spin && !stale ? "motion-safe:animate-spin" : null)} />{pill.label}</span>);@@ -560,6 +570,7 @@ function getVerdictPill(verdict: PullRequestVerdict, t: IssuesT): VerdictPillConreturn {icon: LoaderCircle,tone: "amber",+ spin: true,label: `${verdict.passed}/${verdict.total}`,title: t(($) => $.detail.pull_request_checks_running, {passed: verdict.passed,