-
Is there any functional difference between passing an useMutation({
mutationFn: async () => {
await fn1();
await fn2();
}
})
useMutation({
mutationFn: async () => {
await fn1();
},
onSuccess: async () => {
await fn2();
}
}) |
Beta Was this translation helpful? Give feedback.
Answered by
TkDodo
Aug 1, 2025
Replies: 1 comment 1 reply
-
slight difference is that |
Beta Was this translation helpful? Give feedback.
1 reply
Answer selected by
jennings
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
slight difference is that
onSuccess
runs after the global cache level callbacks, so if one of those throws, the onSuccess handler of useMutation isn’t called anymore.