Possibility of accessing mutation's observers (MutationCache onError) #6671
-
Hello! I wanted to ask if you would consider making it possible to access (currently private property) The case I'm pursuing is to make global error handling as simple as possible, so developers don't have to think about the error handling most of the time: Currently, in v5, we are just using
Or maybe you have some other idea to achieve the above? Thanks! |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 5 replies
-
the callbacks on mutate have a different purpose. You can achieve "if no onError is specified for useMutation" by using |
Beta Was this translation helpful? Give feedback.
The problem here is that even if
mutate
definesonError
, there's no guarantee that it will actually run because the callbacks are scoped to the observer, which can unmount before the mutation finishes. That's why I'd see these two layers as "additional" rather than "we don't need the global one because mutate already defines it"...