I’m migrating from apollo-client@v2 to @apollo/client@v3
I have a rather large codebase where we used to do something like this:
const [mutate, {loading}] = useMutation(...)
const handleClick = () => {
const res = await mutate()
if (res.errors?.length > 0) {
// do something
return
}
// do something else
}
As far as I understand from your documentation , “The mutate function returns a promise that fulfills with your mutation result.”, and from reading the code, it looks like the data returned when awaiting the mutate function should be the same as the data in the object returned from the useMutation (2nd element of the returned tuple).
However, from the typings, the mutate function only seems to expose data, context and extensions (not errors nor error)
What should I understand from this ? Are the types wrong ? Or do you expect people to only use the onError callback to handle ApolloErrors ?