Does queryClient.fetchInfiniteQuery refetch previous pages? #5548
Answered
by
TkDodo
kimurakenshi
asked this question in
Q&A
-
Will this code always fetch the first page and remove any previous pages from the cache or will refetch everything? const data = await queryClient.fetchInfiniteQuery({ queryKey, queryFn }) Should I use My use case for this is a grid that has infinite scrolling. After user scrolls a few times, new pages will loaded but if a filter is applied, the infinite query needs to start over, clear the query cache and only fetch the first page. |
Beta Was this translation helpful? Give feedback.
Answered by
TkDodo
Jun 12, 2023
Replies: 1 comment
-
filter needs to be part of the queryKey then. |
Beta Was this translation helpful? Give feedback.
0 replies
Answer selected by
kimurakenshi
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
filter needs to be part of the queryKey then.