How does setMutationDefaults work? #7355
Replies: 2 comments 1 reply
-
The explanation is in the next paragraph:
Not sure what you mean with that. The example calls
yes.
defaults are applied to your mutation and merged with options passed to
They are merged with a normal object spread, in that order:
yes, if they are paused, they will run.
As said above, if you provide a
|
Beta Was this translation helpful? Give feedback.
-
@TkDodo |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
I am building a React Native Expo app. I've been using and loving Tanstack Query. Currently I'm implementing offline support.
I am confused by the use of setMutationDefaults. The docs say "If you persist offline mutations with the persistQueryClient plugin, mutations cannot be resumed when the page is reloaded unless you provide a default mutation function."
https://tanstack.com/query/v5/docs/framework/react/guides/mutations#persisting-offline-mutations
This paragraph does not explain enough for my brain to grok it. I can understand the need to arbitrarily add setMutationDefault for offline support to work. No worries there. But it seems to be more than a placeholde because it's actually querying stuff in the example.
What I don't understand is:
Thanks for the help
Beta Was this translation helpful? Give feedback.
All reactions