Apollo Elements Apollo Elements Guides API Blog Toggle darkmode

Class Mixins: ApolloMutationMixin

ApolloMutationMixins applies ApolloElementMixin and the ApolloMutationInterface.

Read the mutation component guides for examples and tips.

Attributes

refetch-queries


await-refetch-queries


Signature

ApolloMutationMixin

Parameters

base

B

Properties

static

documentType

'mutation'

refetchQueries

RefetchQueriesType<D> | null

optimisticResponse

OptimisticResponseType<D, V> | undefined

An object that represents the result of this mutation that will be optimistically stored before the server has actually returned a result, or a unary function that takes the mutation's variables and returns such an object.

This is most often used for optimistic UI, where we want to be able to see the result of a mutation immediately, and update the UI later if any errors appear.

mutation

ComponentDocument<D> | null

ignoreResults

boolean

fetchPolicy

Extract<C.FetchPolicy, 'no-cache'> | undefined

controller


called

boolean

awaitRefetchQueries

boolean | undefined

Methods

updater

Parameters

params

Parameters<MutationUpdaterFn<Data<D>, Variables<D, V>>>

Returns

ReturnType<MutationUpdaterFn<Data<D>, Variables<D, V>>>

onError

Parameters

_error

Error

Returns

void

onCompleted

Parameters

_data

Data<D>

Returns

void
public

mutate

This resolves a single mutation according to the options specified and returns a Promise which is either resolved with the resulting data or rejected with an error.

Parameters

params

Partial<C.MutationOptions<Data<D>, Variables<D, V>>>

Returns

Promise<C.FetchResult<Data<D>>>

Exports

import { ApolloMutationMixin } from '@apollo-elements/mixins/apollo-mutation-mixin';