Reputation: 1099
When I'm using the useMutation hook and getting an error on the response the onCompleted method gets triggered. Is that normal behavior?
const [createPerson] = useMutation(CreatePerson, {
onCompleted: () => {
console.log('even onError it`s executed')
}
})
Upvotes: 0
Views: 1583
Reputation: 8962
From our discussion in the chat I take that you have set the error policy of the Apollo Provider
to ignore
:
ignore: Ignore allows you to read any data that is returned alongside GraphQL Errors, but doesn't save the errors or report them to your UI.
This is the reason that the GraphQL errors are ignored. They will only be triggered when using the default policy of none
.
More info about the error policies here and in this thread.
Upvotes: 2