diff --git a/webui/src/routes/import/-ui/import-shared.tsx b/webui/src/routes/import/-ui/import-shared.tsx index fba4e240..f45656c6 100644 --- a/webui/src/routes/import/-ui/import-shared.tsx +++ b/webui/src/routes/import/-ui/import-shared.tsx @@ -22,19 +22,20 @@ export function useImportStaging() { }); // A large staging folder (whole-library migration, #947) is scanned in the background; the - // endpoint returns `scanning: true` until it's done. While scanning, poll so the page fills - // in automatically once the scan completes. A plain setInterval (NOT react-query's - // refetchInterval, which interferes with the data query's error/retry settling) that only - // runs while scanning, so the normal and error states are left completely untouched. + // endpoints return `scanning: true` until it's done. While scanning, poll so the page fills + // in automatically once the scan completes. Invalidate ALL staging queries (files, groups, + // suggestions) — not just files — so the album tab's separate groups query refetches too, + // otherwise it would stay stuck on its initial {scanning} response. A plain setInterval (NOT + // react-query's refetchInterval) that only runs while scanning leaves normal/error states + // untouched; only currently-mounted queries actually refetch. const scanning = stagingQuery.data?.scanning === true; - const { refetch } = stagingQuery; useEffect(() => { if (!scanning) return undefined; const id = window.setInterval(() => { - void refetch(); + void invalidateImportStagingQueries(queryClient); }, 1500); return () => window.clearInterval(id); - }, [scanning, refetch]); + }, [scanning, queryClient]); return { refreshStaging: async () => {