API Documentation / @pinia/colada / UseMutationOptionsGlobal
Interface: UseMutationOptionsGlobal 
Options for mutations that can be globally overridden.
Properties 
gcTime? 
optional gcTime: number | false;Time in ms after which, once the mutation is no longer being used, it will be garbage collected to free resources. Set to false to disable garbage collection (not recommended).
Default 
60_000 (1 minute)onError()? 
optional onError: (error, vars, context) => unknown;Runs when a mutation encounters an error.
Parameters 
error 
unknown
The error thrown by the mutation.
vars 
unknown
The variables passed to the mutation.
context 
The merged context from onMutate and the global context. Properties returned by onMutate can be undefined if onMutate throws.
UseMutationGlobalContext | Partial<Record<never, never>>
Returns 
unknown
onMutate()? 
optional onMutate: (vars) => _Awaitable<undefined | null | void | UseMutationGlobalContext>;Runs before a mutation is executed. It can return a value that will be passed to mutation, onSuccess, onError and onSettled. If it returns a promise, it will be awaited before running mutation.
Parameters 
vars 
unknown
The variables passed to the mutation.
Returns 
_Awaitable<undefined | null | void | UseMutationGlobalContext>
onSettled()? 
optional onSettled: (data, error, vars, context) => unknown;Runs after the mutation is settled, regardless of the result.
Parameters 
data 
unknown
The result of the mutation. undefined when a mutation failed.
error 
unknown
The error thrown by the mutation. undefined if the mutation was successful.
vars 
unknown
The variables passed to the mutation.
context 
The merged context from onMutate and the global context. Properties returned by onMutate can be undefined if onMutate throws.
UseMutationGlobalContext | Partial<Record<never, never>>
Returns 
unknown
onSuccess()? 
optional onSuccess: (data, vars, context) => unknown;Runs when a mutation is successful.
Parameters 
data 
unknown
The result of the mutation.
vars 
unknown
The variables passed to the mutation.
context 
UseMutationGlobalContext
The merged context from onMutate and the global context.
Returns 
unknown