Replies: 3 comments 1 reply
-
What use-case do you have where you would call Usually, writing to the query cache should be done rarely, because whatever you write will be overwritten with the next update. The two cases I know are:
|
Beta Was this translation helpful? Give feedback.
-
It's a non-optimistic update on a combined detail/edit page.
|
Beta Was this translation helpful? Give feedback.
-
The other advantage of having it as a method on the query result is that it can be strongly typed. queryClient.setQueryData can be used to set the query to an object of the wrong type. |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
Since I can call refetch() and remove() on a query result, I should be able to call queryClient.setQueryData too. I would prefer to call it on the query result so I don't have to repeat the query key.
What do you think?
Beta Was this translation helpful? Give feedback.
All reactions