Replies: 7 comments 31 replies
-
Additionnal info: when I unfocus/focus on the app, it works well, the fetching is done again and my data are correct. And queryCache.clear() does the trick but it's not what I want for sure. |
Beta Was this translation helpful? Give feedback.
-
+1 anybody figured it out yet? 😄 |
Beta Was this translation helpful? Give feedback.
-
queryClient.invalidateQueries also works for infinite queries. Per default, it will refetch all pages, but we now also have a |
Beta Was this translation helpful? Give feedback.
-
is there a solution yet. For me if i invalidate the query only last page gets refetched and rendered. I want to fetch all of the pages |
Beta Was this translation helpful? Give feedback.
-
i tried this
and then when I am trying queryClient.invalidateQueries(["getAllCases"]); |
Beta Was this translation helpful? Give feedback.
-
Hello, @TkDodo I still have an issue with invalidating the infinity query.
While the component where I am using infinity query mounted, I can invalidate the data and it data will be refetched. As soon as I unmount this component and invalided data anywhere else and returned back I could see that state invalidated true, but the data is not refetching. For regular queries works fine. As workaround I use refetch method in case the query is Invalidted.
My infinity query code
|
Beta Was this translation helpful? Give feedback.
-
Hi @TkDodo I’m encountering an issue with infinite query invalidations, and I’m a bit confused by the behavior. However, before those set of refetches completes(initiated by the invalidateQueries call), a second mutation occurs (another edit or change) that again calls
I expected that the second const invalidate = () => {
queryClient.cancelQueries({ queryKey: ['infinite'] });
queryClient.invalidateQueries( { queryKey: ['infinite'] });
}; This issue could become worse if multiple mutations occur in quick succession, each invalidating the query. Multiple sets of queries would start refetching the same pages (e.g., one at page 10, another at page 8, and so on), and they would all continue fetching until all pages are invalidated. |
Beta Was this translation helpful? Give feedback.
-
I do something like this on a click:
and in my list, I do this:
My query is correctly done, with the right collection of IDs. However, my list doesn't refresh well.
I do something like this:
Both of my requets are refetched, but the data are quite frozen there:
watchedBillsInfiniteQuery?.data
any idea?
Beta Was this translation helpful? Give feedback.
All reactions