T
TanStack2y ago
conscious-sapphire

is a promise returned from onError callback on a mutation awaited?

Hey all, just a quick question. I know when we do for example an onsuccess and return a promise to invalidate a given query i will be awaited. Does this also count for the onError callback? I need to do some logic whenever a mutation failes, and after that retry the mutation. For example. - add to cart - onError -> check if cart exists/create cart - rertry add to cart
4 Replies
like-gold
like-gold2y ago
onError on useMutation - yes onError on mutae - no
conscious-sapphire
conscious-sapphireOP2y ago
Oke thanks, seems like it was in the docs read over it. do you know if its possible to re-call the mutation in the onError callback? is the retry callback fired after the onError, or is the onError not called untill the failureCount is met?
like-gold
like-gold2y ago
the latter
conscious-sapphire
conscious-sapphireOP2y ago
thanks1

Did you find this page helpful?