OptionalawaitRefetchQueries?: booleanOptionalcontext?: DefaultContextIf you're using Apollo Link, this object is the initial value of the context object that's passed along your link chain.
OptionalerrorPolicy?: ErrorPolicySpecifies how the mutation handles a response that returns both GraphQL errors and partial results.
For details, see GraphQL error policies.
The default value is none, meaning that the mutation result includes error details but not partial results.
OptionalfetchPolicy?: MutationFetchPolicyProvide no-cache if the mutation's result should not be written to the Apollo Client cache.
The default value is network-only (which means the result is written to the cache).
Unlike queries, mutations do not support fetch policies besides network-only and no-cache.
OptionalkeepRootFields?: booleanTo avoid retaining sensitive information from mutation root field
arguments, Apollo Client v3.4+ automatically clears any ROOT_MUTATION
fields from the cache after each mutation finishes. If you need this
information to remain in the cache, you can prevent the removal by passing
keepRootFields: true to the mutation. ROOT_MUTATION result data are
also passed to the mutation update function, so we recommend obtaining
the results that way, rather than using this option, if possible.
A GraphQL document, often created with gql from the graphql-tag
package, that contains a single mutation inside of it.
OptionalonQueryUpdated?: OnQueryUpdated<any>Optional callback for intercepting queries whose cache data has been updated by the mutation, as well as any queries specified in the refetchQueries: [...] list passed to client.mutate.
Returning a Promise from onQueryUpdated will cause the final mutation Promise to await the returned Promise. Returning false causes the query to be ignored.
OptionaloptimisticResponse?: By providing either an object or a callback function that, when invoked after
a mutation, allows you to return optimistic data and optionally skip updates
via the IGNORE sentinel object, Apollo Client caches this temporary
(and potentially incorrect) response until the mutation completes, enabling
more responsive UI updates.
For more information, see Optimistic mutation results.
OptionalrefetchQueries?: An array (or a function that returns an array) that specifies which queries you want to refetch after the mutation occurs.
Each array value can be either:
An object containing the query to execute, along with any variables
A string indicating the operation name of the query to refetch
Optionalupdate?: MutationUpdaterFunction<TData, TVariables, TCache>A function used to update the Apollo Client cache after the mutation completes.
For more information, see Updating the cache after a mutation.
OptionalupdateQueries?: MutationQueryReducersMap<TData>A MutationQueryReducersMap, which is map from query names to
mutation query reducers. Briefly, this map defines how to incorporate the
results of the mutation into the results of queries that are currently
being watched by your application.
If
true, makes sure all queries included inrefetchQueriesare completed before the mutation is considered complete.The default value is
false(queries are refetched asynchronously).