fix infinite loader potentially refetching count multiple times on query change

This commit is contained in:
jeffvli
2025-12-28 06:55:58 -08:00
parent ef631d12cc
commit 304c38db1e
@@ -186,10 +186,9 @@ export const useItemListInfiniteLoader = ({
lastFetchedPageRef.current = -1;
currentVisibleRangeRef.current = null;
// Invalidate and wait for count query to refetch (this will suspend via useSuspenseQuery)
await queryClient.refetchQueries({
// Invalidate and wait for count query to refetch
await queryClient.ensureQueryData({
queryKey: countQueryKey,
type: 'active',
});
// Fetch the first page after count is refetched