fix(catalog-react): clear fetch dedup ref on failure instead of reverting to previous params

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Signed-off-by: Fredrik Adelöw <freben@gmail.com>
This commit is contained in:
Fredrik Adelöw
2026-05-21 10:12:51 +02:00
parent 720fb542d9
commit 77e7ad4c7d
@@ -315,7 +315,6 @@ export const EntityListProvider = <EntityFilters extends DefaultEntityFilters>(
if (isEqual(fetchParams, lastFetchParamsRef.current)) {
return;
}
const prevFetchParams = lastFetchParamsRef.current;
lastFetchParamsRef.current = fetchParams;
const gen = ++fetchGenRef.current;
@@ -329,7 +328,10 @@ export const EntityListProvider = <EntityFilters extends DefaultEntityFilters>(
}
} catch (e) {
if (gen === fetchGenRef.current) {
lastFetchParamsRef.current = prevFetchParams;
// Clear the ref so the same params can be retried, and so
// a response discarded due to a concurrent request (gen mismatch)
// doesn't permanently block fetching those params again.
lastFetchParamsRef.current = undefined;
setError(e as Error);
}
} finally {