From 74cc4c87229e2bc0dc64d296c20d91cc2e648610 Mon Sep 17 00:00:00 2001 From: Marcel Date: Thu, 28 May 2026 12:56:00 +0200 Subject: [PATCH] fix(admin): drop processed count from RUNNING import card The whole document load commits in one transaction, so a live counter sits at 0 for the entire run and only jumps to the final number on completion. Showing "0" next to the spinner read as "nothing happening" and prompted repeated retriggers. Render just the spinner + running label until the DONE branch displays the final processed count. Co-Authored-By: Claude Opus 4.7 --- .../src/routes/admin/system/ImportStatusCard.svelte | 11 +++-------- .../admin/system/ImportStatusCard.svelte.test.ts | 8 +++++--- 2 files changed, 8 insertions(+), 11 deletions(-) diff --git a/frontend/src/routes/admin/system/ImportStatusCard.svelte b/frontend/src/routes/admin/system/ImportStatusCard.svelte index e6556857..d6ebb2a2 100644 --- a/frontend/src/routes/admin/system/ImportStatusCard.svelte +++ b/frontend/src/routes/admin/system/ImportStatusCard.svelte @@ -42,14 +42,9 @@ function reasonLabel(code: string): string { aria-label={m.admin_system_import_status_running()} class="inline-block h-5 w-5 animate-spin rounded-full border-2 border-ink-3 border-t-brand-mint motion-reduce:animate-none" > -
-

- {importStatus.processed} -

-

- {m.admin_system_import_status_running()} -

-
+

+ {m.admin_system_import_status_running()} +

{:else if importStatus?.state === 'DONE'}
diff --git a/frontend/src/routes/admin/system/ImportStatusCard.svelte.test.ts b/frontend/src/routes/admin/system/ImportStatusCard.svelte.test.ts index d7470cda..f2248c58 100644 --- a/frontend/src/routes/admin/system/ImportStatusCard.svelte.test.ts +++ b/frontend/src/routes/admin/system/ImportStatusCard.svelte.test.ts @@ -26,15 +26,17 @@ describe('ImportStatusCard', () => { await expect.element(getByTestId('spinner')).toBeInTheDocument(); }); - it('shows processed count at text-base while RUNNING', async () => { + it('shows no processed count while RUNNING (spinner only, no misleading 0)', async () => { + // The whole document load commits in one transaction, so a live count would sit at 0 + // until the end. Show just the spinner + "running" label instead of a stuck "0". const { getByTestId } = render(ImportStatusCard, { props: { - importStatus: makeStatus({ state: 'RUNNING', statusCode: 'IMPORT_RUNNING', processed: 7 }), + importStatus: makeStatus({ state: 'RUNNING', statusCode: 'IMPORT_RUNNING', processed: 0 }), ontrigger: () => {} } }); - await expect.element(getByTestId('processed-count')).toHaveTextContent('7'); + await expect.element(getByTestId('processed-count')).not.toBeInTheDocument(); }); it('shows processed count while DONE', async () => {