mirror of
https://github.com/jeffvli/feishin.git
synced 2026-05-09 20:29:36 +02:00
fix infinite loader potentially refetching count multiple times on query change
This commit is contained in:
@@ -186,10 +186,9 @@ export const useItemListInfiniteLoader = ({
|
|||||||
lastFetchedPageRef.current = -1;
|
lastFetchedPageRef.current = -1;
|
||||||
currentVisibleRangeRef.current = null;
|
currentVisibleRangeRef.current = null;
|
||||||
|
|
||||||
// Invalidate and wait for count query to refetch (this will suspend via useSuspenseQuery)
|
// Invalidate and wait for count query to refetch
|
||||||
await queryClient.refetchQueries({
|
await queryClient.ensureQueryData({
|
||||||
queryKey: countQueryKey,
|
queryKey: countQueryKey,
|
||||||
type: 'active',
|
|
||||||
});
|
});
|
||||||
|
|
||||||
// Fetch the first page after count is refetched
|
// Fetch the first page after count is refetched
|
||||||
|
|||||||
Reference in New Issue
Block a user