tridion-sites-extensions-api-docs

Home > @tridion-sites/extensions > MutationOptions

MutationOptions interface

Signature:

export interface MutationOptions<TData = unknown, TError = unknown, TVariables = void>

Properties

Property Modifiers Type Description
cacheTime?   number (Optional)
meta?   Record<string, unknown> (Optional) If set, it stores additional information on the mutation cache entry that can be used as needed. It will be accessible wherever the mutation is available (eg. onError, onSuccess functions of the MutationCache).
onError?   (error: TError, variables: TVariables) => Promise<void> | void (Optional) This function will fire if the mutation encounters an error and will be passed the error.
onMutate?   (variables: TVariables) => Promise<void> | void (Optional) This function will fire before the mutation function is fired and is passed the same variables the mutation function would receive.
onSettled?   (data: TData | undefined, error: TError | null, variables: TVariables) => Promise<void> | void (Optional) This function will fire when the mutation is either successfully fetched or encounters an error and be passed either the data or error.
onSuccess?   (data: TData, variables: TVariables) => Promise<void> | void (Optional) This function will fire when the mutation is successful and will be passed the mutation’s result.
retry?   boolean | number | ((failureCount: number, error: TError) => boolean) (Optional) Defaults to 0. - If false, failed mutations will not retry. - If true, failed mutations will retry infinitely. - If set to a number, e.g. 3, failed mutations will retry until the failed mutations count meets that number.
retryDelay?   number | ((failureCount: number, error: TError) => number) (Optional) This function receives a retryAttempt integer and the actual Error and returns the delay to apply before the next attempt in milliseconds. Alternatively, you can pass the delay in milliseconds.
variables?   TVariables (Optional)