Shared task board where people and AI coding agents work as teammates. Source-available, self-hostable.
Go
MUL-9166 fix(dev): keep the dev toolbar Cache chip a fixed width while fetching (#10508)
Jiayuan Zhange66f8dcb957e
diff --git a/packages/views/dev-toolbar/dev-toolbar.test.tsx b/packages/views/dev-toolbar/dev-toolbar.test.tsxindex 779995c655..3ed76eff6b 100644--- a/packages/views/dev-toolbar/dev-toolbar.test.tsx+++ b/packages/views/dev-toolbar/dev-toolbar.test.tsx@@ -224,6 +224,23 @@ describe("DevToolbar", () => {expect(queryClient.getQueryState(["issues", "ws-1", "detail", "issue-1"])?.isInvalidated).toBe(false);});+ it("keeps the cache fetch counter in place while queries load and settle", async () => {+ const { queryClient } = renderToolbar();+ const counter = screen.getByTestId("dev-toolbar-cache-fetching");+ expect(counter).toHaveTextContent("↻0");++ let settle!: (value: string[]) => void;+ void queryClient.fetchQuery({+ queryKey: ["labels", "ws-1"],+ queryFn: () => new Promise<string[]>((resolve) => (settle = resolve)),+ });+ await waitFor(() => expect(counter).toHaveTextContent("↻1"));++ settle([]);+ await waitFor(() => expect(counter).toHaveTextContent("↻0"));+ expect(screen.getByTestId("dev-toolbar-cache-fetching")).toBe(counter);+ });+it("shows runtime health and opens the issue a running agent task works on", async () => {setCurrentWorkspace("acme", "ws-1");mocks.listRuntimes.mockResolvedValue([diff --git a/packages/views/dev-toolbar/dev-toolbar.tsx b/packages/views/dev-toolbar/dev-toolbar.tsxindex c04bbbe3c1..13a32b6622 100644--- a/packages/views/dev-toolbar/dev-toolbar.tsx+++ b/packages/views/dev-toolbar/dev-toolbar.tsx@@ -220,7 +220,19 @@ export function DevToolbar({ build, apiUrl, route, onNavigate }: DevToolbarPropslabel="Cache"value={String(queries.length)}wide- extra={fetching > 0 && <span className="text-brand">{`· ${fetching}↻`}</span>}+ extra={+ // Fetches start and settle many times a second; a slot that came and+ // went would resize the chip and shift the whole bar each time.+ <span+ data-testid="dev-toolbar-cache-fetching"+ className={cn(+ "inline-block min-w-[3ch] tabular-nums",+ fetching > 0 ? "text-brand" : "text-faint-foreground",+ )}+ >+ {`↻${fetching}`}+ </span>+ }><CachePanel now={now} /></Metric>