fix(views): spin the running-checks icon in the PR verdict pill

The loader icon on a PR whose checks are running stood still. It now
spins (motion-safe), and stops when the snapshot is stale, since a stale
snapshot can't vouch that the checks are still running.

MUL-7767

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-authored-by: multica-agent <github@multica.ai>
This commit is contained in:
Jiayuan Zhang
2026-09-27 22:42:16 +08:00
co-authored by Claude Opus 5.5 multica-agent
parent 1320f2b595
commit 7b7f924092
2 changed files with 23 additions and 1 deletions
@@ -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 () => {
@@ -369,6 +369,8 @@ 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;
}
/**
@@ -500,7 +502,8 @@ function VerdictPill({ pill, stale, title }: { pill: VerdictPillConfig; stale: b
stale ? "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>
);
@@ -567,6 +570,7 @@ function getVerdictPill(verdict: PullRequestVerdict, t: IssuesT): VerdictPillCon
return {
icon: LoaderCircle,
tone: "amber",
spin: true,
label: `${verdict.passed}/${verdict.total}`,
title: t(($) => $.detail.pull_request_checks_running, {
passed: verdict.passed,