Closed teebszet closed 4 years ago
this looks like React specific for me because I can't find it in mutate
API https://www.apollographql.com/docs/react/api/core/ApolloClient/#ApolloClient.mutate which we use
I think a standard observer next callback should fit your needs
apollo.mutate(..).subscribe(results => ...)
@fetis thanks, yeah you're right that should be the API to be referencing.
my use case is actually to have a callback or hook for after the update function finishes, and the cache has been updated (which, admittedly, the onComplete callback also does not cover).
after I posted this, I looked through the apollo client query manager code, and my conclusion was no such hook exists, but for me it would be a nice to have! I still haven't figured out a workaround for this
Although it is described in the Apollo Client v3 documentation here: https://www.apollographql.com/docs/react/data/mutations/, onCompleted is not defined as one of the accepted mutation options.
I'm using graphql-codegen to generate the mutation service and calling it like this:
Environment:
@apollo/client
: 3.2.5apollo-angular
: 2.1.0graphql
: 15.0.0@angular/core
: 9.0.7@angular/cli
: 9.0.7typescript
: 3.7.5@graphql-codegen/cli
: 1.18.0@graphql-codegen/introspection
: 1.13.1@graphql-codegen/typescript
: 1.13.1@graphql-codegen/typescript-apollo-angular
: 1.13.1@graphql-codegen/typescript-operations
: 1.13.1