T
TanStack2y ago
metropolitan-bronze

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
genetic-orange
genetic-orange2y ago
onError on useMutation - yes onError on mutae - no
metropolitan-bronze
metropolitan-bronzeOP2y 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?
genetic-orange
genetic-orange2y ago
the latter
metropolitan-bronze
metropolitan-bronzeOP2y ago
thanks1

Did you find this page helpful?