Call the onError function or rollback from within onSuccess #1339
Answered
by
TkDodo
jrcardwell
asked this question in
Q&A
-
Our API posts return a 'message' column that may be blank or contain a warning or error message. I want to rollback an optimistic mutation if in the OnSuccess function the message is not blank. Is there a way to call OnError or access the (now mutated) original values with which to rollback from within Mutate's OnSuccess ? |
Beta Was this translation helpful? Give feedback.
Answered by
TkDodo
Dec 1, 2020
Replies: 1 comment 1 reply
-
I think the easiest way would be to handle it on the mutation function itself. You can either:
|
Beta Was this translation helpful? Give feedback.
1 reply
Answer selected by
jrcardwell
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I think the easiest way would be to handle it on the mutation function itself. You can either: