How to prevent useInfiniteQuery to re-fetch previous pages? #2569
-
Hello, I'm facing an issue with In my case, I have an infinite scroll with a filter. While the user scrolls in the component, I call my API and I compute the next page to be called based on the last one in the getNextPageParams. I use something like this as the key for the queries: Everything works beautifully. However, considering the following situation:
I would like to have the opportunity to reset the query I've tried to use Am I missing something? |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 6 replies
-
if your
this should reduce the the pages in the cache to the first page only. |
Beta Was this translation helpful? Give feedback.
if your
search
goes to empty string, before you set it to local state, you can do:this should reduce the the pages in the cache to the first page only.