Mutation -> Invalidation + Refetch or setQueryData
Currently in our app, we have a lot of scenarios where we do the following:
Having read around I am feeling that we could instead use
What are the pros / cons of this, is there a recommended best practice where we update some data via a mutation and need our results immediately. (The queries would be 'active' but don't seem to fetch data until refocus / navigation after invalidation without the refetch call).
Thanks!
Having read around I am feeling that we could instead use
setQueryData here in the onSuccess of the useMutation?What are the pros / cons of this, is there a recommended best practice where we update some data via a mutation and need our results immediately. (The queries would be 'active' but don't seem to fetch data until refocus / navigation after invalidation without the refetch call).
Thanks!