The data in useQuery gets update when using queryClient.setQueriesData of useQueryClient(). Shouldn't onSuccess be also updated? #5192
-
Thus eliminating the need of useEffect. But if we use this approach and need to update the cache after mutation, the onSuccess's data won't be updated. This cause the need of useEffect. |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
This is on purpose - onSuccess is tied to a successful run of the QueryFunction. What is |
Beta Was this translation helpful? Give feedback.
This is on purpose - onSuccess is tied to a successful run of the QueryFunction. What is
setData
doing? You likely don't need to do that - neither in onSuccess nor in an effect