Mutation promise resolution
The mutation docs mention that "additional mutation callbacks won't run if the component unmounts before the mutation finishes." What exactly does this mean? Does this mean that anything that would be triggered by any mutation callback will not happen if the component unmounts before it completes?
4 Replies
sunny-greenOP•3y ago
For instance if I wanted to set the refetchInterval of my queries globally to something more rapid for the duration of a mutation, then set it back once the mutation resolves, would that work as intended if the component that the mutation is part of unmounted before the mutation was successful/settled?
graceful-blue•3y ago
The callbacks on useMutation always run. This is about the callbacks in mutate
graceful-blue•3y ago
Mastering Mutations in React Query
Learn all about the concept of performing side effects on the server with React Query.
sunny-greenOP•3y ago
Thank you for the clarification!