You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
useMutation({
mutationFn: addTodo,
onSuccess: (data, variables, context) => {
// I will fire first
},
onError: (error, variables, context) => {
// I will fire first
},
onSettled: (data, error, variables, context) => {
// I will fire first
},
})
mutate(todo, {
onSuccess: (data, variables, context) => {
// I will fire second!
},
onError: (error, variables, context) => {
// I will fire second!
},
onSettled: (data, error, variables, context) => {
// I will fire second!
},
})
What kind of issues did you encounter with SWR?
swr onSuccess in trigger will override useSWRMutation's onSuccess, make onSuccess's common logic is hard to reuse
see source code here , mergeObjects will use opts's onSuccess
How did you expect SWR to behave here?
Will swr support onSucess both in trigger options and useSWRMutation options?
Besides, onSuccess override is missing description in Doc.
The text was updated successfully, but these errors were encountered:
Bug report
Description / Observed Behavior
I used to use react-query ,mutation onSuccess will call useMutation's onSuccess firstly, and call mutate onSuccess secondly.
see here https://tanstack.com/query/v4/docs/framework/react/guides/mutations#consecutive-mutations
What kind of issues did you encounter with SWR?
swr onSuccess in trigger will override useSWRMutation's onSuccess, make onSuccess's common logic is hard to reuse
see source code here , mergeObjects will use opts's onSuccess
Expected Behavior
How did you expect SWR to behave here?
Will swr support onSucess both in trigger options and useSWRMutation options?
Besides, onSuccess override is missing description in Doc.
The text was updated successfully, but these errors were encountered: