how to reset useInfiniteQuery?
hello, I have been stuck for a while on how would i reset my useInfiniteQuery, my case was i implement load more button with infinite query then i want to reset it back to only have 1 pages, how can i do it?
i have used refetch, invalidateQueries, resetQueries, none of these works
thank you
1 Reply
adverse-sapphire•4y ago
With setQueryData, similar to: https://tanstack.com/query/v4/docs/guides/infinite-queries#what-if-i-want-to-manually-update-the-infinite-query
Infinite Queries | TanStack Query Docs
Rendering lists that can additively "load more" data onto an existing set of data or "infinite scroll" is also a very common UI pattern. React Query supports a useful version of useQuery called useInfiniteQuery for querying these types of lists.
When using useInfiniteQuery, you'll notice a few things are different: