-
I am writing an invoice search screen that allows modifying an invoice with a mutation. The mutation returns the updated invoice. This means I can update the currently search results without re-fetching the query. The same invoice could be in other search queries. Instead of checking all queries for the modified invoice, I was planning on invalidating all of the invoice queries, except the current one. If I use a similar key for the invoice queries, I can invalidate all of them with one invalidateQueries call. Is there a way to invalidate all of them except one? The function used to update the current search query is below:
|
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
there is.
if the function returns true, it will be invalidated, otherwise not. you can achieve something similar with
|
Beta Was this translation helpful? Give feedback.
there is.
invalidateQueries
also takes a predicate function as filter argument instead of the partial key. the example from the docs is:if the function returns true, it will be invalidated, otherwise not.
you can achieve something similar with
setQueryData
if you don't want to invalidate by doing:findAll
takes the same filter (partial query key, predicate function) as invalidateQueries