@twilio/flex-sdk
    Preparing search index...

    Type Alias MutateOptions<TData, TVariables, TCache>

    MutateOptions: {
        awaitRefetchQueries?: boolean;
        context?: DefaultContext;
        errorPolicy?: ErrorPolicy;
        fetchPolicy?: MutationFetchPolicy;
        keepRootFields?: boolean;
        mutation: DocumentNode | TypedDocumentNode<TData, TVariables>;
        onQueryUpdated?: OnQueryUpdated<any>;
        optimisticResponse?:
            | Unmasked<NoInfer<TData>>
            | (
                (
                    vars: TVariables,
                    { IGNORE }: { IGNORE: IgnoreModifier },
                ) => Unmasked<NoInfer<TData>> | IgnoreModifier
            );
        refetchQueries?:
            | (
                (
                    result: NormalizedExecutionResult<Unmasked<TData>>,
                ) => InternalRefetchQueriesInclude
            )
            | InternalRefetchQueriesInclude;
        update?: MutationUpdaterFunction<TData, TVariables, TCache>;
        updateQueries?: MutationQueryReducersMap<TData>;
    } & VariablesOption<NoInfer<TVariables>>

    Type Parameters

    • TData = unknown
    • TVariables extends OperationVariables = OperationVariables
    • TCache extends ApolloCache = ApolloCache

    Type Declaration

    • OptionalawaitRefetchQueries?: boolean

      If true, makes sure all queries included in refetchQueries are completed before the mutation is considered complete.

      The default value is false (queries are refetched asynchronously).

      1. Operation options
    • Optionalcontext?: DefaultContext

      If you're using Apollo Link, this object is the initial value of the context object that's passed along your link chain.

      1. Networking options
    • OptionalerrorPolicy?: ErrorPolicy

      Specifies 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.

      1. Operation options
    • OptionalfetchPolicy?: MutationFetchPolicy

      Provide 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.

      1. Caching options
    • OptionalkeepRootFields?: boolean

      To 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.

    • mutation: DocumentNode | TypedDocumentNode<TData, TVariables>

      A GraphQL document, often created with gql from the graphql-tag package, that contains a single mutation inside of it.

      1. Operation options
    • 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.

      1. Operation options
    • OptionaloptimisticResponse?:
          | Unmasked<NoInfer<TData>>
          | (
              (
                  vars: TVariables,
                  { IGNORE }: { IGNORE: IgnoreModifier },
              ) => Unmasked<NoInfer<TData>> | IgnoreModifier
          )

      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.

      1. Caching options
    • OptionalrefetchQueries?:
          | (
              (
                  result: NormalizedExecutionResult<Unmasked<TData>>,
              ) => InternalRefetchQueriesInclude
          )
          | InternalRefetchQueriesInclude

      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

      1. Operation options
    • 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.

      1. Caching options
    • 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.