From 1ca336eb5484686fb1588efb13107cc84c0657c0 Mon Sep 17 00:00:00 2001 From: Jesus Armando Anaya <1445792+JArmandoAnaya@users.noreply.github.com> Date: Wed, 26 Aug 2026 05:38:15 -0700 Subject: [PATCH] fix(ui): the export dialog reports a failure only once the job has settled --- frontend/ui-core/src/screens/DatasetScreen.tsx | 4 +++- frontend/ui-core/src/screens/dataset.test.tsx | 12 +++++++++++- 2 files changed, 14 insertions(+), 2 deletions(-) diff --git a/frontend/ui-core/src/screens/DatasetScreen.tsx b/frontend/ui-core/src/screens/DatasetScreen.tsx index b668bb14..4e5d5acb 100644 --- a/frontend/ui-core/src/screens/DatasetScreen.tsx +++ b/frontend/ui-core/src/screens/DatasetScreen.tsx @@ -1001,7 +1001,9 @@ function ExportDialog({ const lost = failure !== null && needsConsent ? lostClasses(failure.detail) : null; const running = exportRelease.isPending || (job.data !== undefined && !isSettled(job.data)); const stopped = - job.data !== undefined && job.data.state !== "succeeded" ? job.data : null; + job.data !== undefined && isSettled(job.data) && job.data.state !== "succeeded" + ? job.data + : null; function run(allowLossy: boolean): void { setSaved(false); diff --git a/frontend/ui-core/src/screens/dataset.test.tsx b/frontend/ui-core/src/screens/dataset.test.tsx index 5c3fb99a..00668c36 100644 --- a/frontend/ui-core/src/screens/dataset.test.tsx +++ b/frontend/ui-core/src/screens/dataset.test.tsx @@ -10,7 +10,7 @@ */ import { QueryClient } from "@tanstack/react-query"; -import { render, screen, waitFor, within } from "@testing-library/react"; +import { cleanup, render, screen, waitFor, within } from "@testing-library/react"; import { userEvent } from "@testing-library/user-event"; import { afterEach, beforeEach, describe, expect, it, vi } from "vitest"; import type { JSX, ReactNode } from "react"; @@ -715,6 +715,16 @@ describe("export, and the third gate word", () => { expect(badge.className).toContain("text-primary"); }); + it("shows no failure while the export is still queued or running", async () => { + // A job that has not settled has nothing to explain yet; the failure + // sentence belongs to a job that stopped, never to one still working. + await exportWith("queued"); + expect(screen.queryByTestId("export-job-error")).toBeNull(); + cleanup(); + await exportWith("running"); + expect(screen.queryByTestId("export-job-error")).toBeNull(); + }); + it("says a finished export is done, in the success token (#391)", async () => { const badge = await exportWith("succeeded"); expect(badge.textContent).toContain("Done");