-
I have a problem, where the invalidateQueries does not start a refetch, when there is only one item left. Consider the code below. What am I missing here?
|
Beta Was this translation helpful? Give feedback.
Replies: 3 comments 1 reply
-
invalidateQueries only refetches queries that are actively used. Others are just marked as stale. Hard to say without seeing which component is rendered when, but my guess is that removing the last one unmounts the last observer, thus invalidation doesn't refetch. you can pass filters to If that is not the issue, please show a minimal, runnable reproduction (codesandbox, stackblitz) |
Beta Was this translation helpful? Give feedback.
-
Using refetchInactive: true, does not fix the issue |
Beta Was this translation helpful? Give feedback.
-
This was a problem in the getFavorites function, which did a fetch and did not return anything if the response code was 204. It was changed to return an empty array and that solved it. |
Beta Was this translation helpful? Give feedback.
This was a problem in the getFavorites function, which did a fetch and did not return anything if the response code was 204. It was changed to return an empty array and that solved it.