Open Source Platform for DTC, B2B Commerce, Marketplaces & Omnichannel. REST APIs, TypeScript SDKs, and production-ready Next.js storefront. Self-host it. Own your data. No vendor lock-in. Zero platform fees.
Ruby b2b-commercee-commerceecommerceecommerce-apiecommerce-frameworkecommerce-platformheadlessheadless-commerceheadless-ecommercemarketplacemulti-tenantmulti-vendormulti-vendor-ecommerceopen-sourcespree-commerce
Fix retry failed rows race condition with refetch (#14309)
Damian Legawiec35649b683a0f
diff --git a/packages/dashboard/e2e/imports.spec.ts b/packages/dashboard/e2e/imports.spec.tsindex 29ac15d8f9..da04d820b9 100644--- a/packages/dashboard/e2e/imports.spec.ts+++ b/packages/dashboard/e2e/imports.spec.ts@@ -31,10 +31,9 @@ test.describe('csv import', () => {await openImportSheet(page, creds.store_id)// Rows without name/price are guaranteed row-level failures that feed the- // failed-rows report without failing the whole import. Thirty of them keep- // the retry pass long enough to observe its transient copy (a single row- // re-processes faster than the post-mutation refetch) and paginate the- // failure report (25 per page).+ // failed-rows report without failing the whole import. Thirty of them+ // paginate the failure report (25 per page) so the "next page" control has+ // something to page through.const badRows = Array.from({ length: 30 }, (_, i) => {const n = String(i + 1).padStart(2, '0')return `e2e-import-bad-${n}-${suffix},E2E-IMP-BAD-${n}-${suffix},,`diff --git a/packages/dashboard/src/hooks/use-imports.ts b/packages/dashboard/src/hooks/use-imports.tsindex 715028980c..314e8a62a4 100644--- a/packages/dashboard/src/hooks/use-imports.ts+++ b/packages/dashboard/src/hooks/use-imports.ts@@ -62,7 +62,14 @@ export function useRetryFailedRows(id: string) {mutationFn: () => adminClient.imports.retryFailedRows(id),onSuccess: (imp) => {queryClient.setQueryData<Import>(buildKey('imports', id), imp)- queryClient.invalidateQueries({ queryKey: buildKey('imports') })+ // `refetchType: 'none'` refreshes the history list on its next mount+ // without refetching the active wizard detail query: the retry response+ // already carried the fresh `processing` status we just cached, and an+ // immediate refetch would race the (fast) background retry job — often+ // returning `completed` before the "Retrying failed rows" state is ever+ // rendered. Marking stale keeps the poll as the single source of the+ // completion transition.+ queryClient.invalidateQueries({ queryKey: buildKey('imports'), refetchType: 'none' })},onError: (err) => {toast.error(err instanceof Error ? err.message : String(err))