API Documentation / @pinia/colada / UseMutationReturn
Interface: UseMutationReturn<TData, TVars, TError, TContext>
Extends
UseMutationEntryExtensions<TData,TVars,TError,TContext>
Type Parameters
TData
TData
TVars
TVars
TError
TError
TContext
TContext extends Record<any, any> = _EmptyObject
Properties
asyncStatus
asyncStatus: ShallowRef<AsyncStatus>;Status of the mutation. Becomes 'loading' while the mutation is being fetched, is 'idle' otherwise.
data
data: ShallowRef<TData | undefined>;The result of the mutation. undefined if the mutation has not been called yet.
dataUpdatedAt
dataUpdatedAt: ShallowRef<number>;Timestamp of when data was last successfully returned. TanStack Query compatible property.
Inherited from
UseMutationEntryExtensions.dataUpdatedAterror
error: ShallowRef<TError | null>;The error of the mutation. null if the mutation has not been called yet or if it was successful.
errorUpdatedAt
errorUpdatedAt: ShallowRef<number>;Timestamp of when an error last occurred. TanStack Query compatible property.
Inherited from
UseMutationEntryExtensions.errorUpdatedAtisDelaying
isDelaying: ShallowRef<boolean>;Returns whether the mutation is currently delaying its asyncStatus from becoming 'loading'. Requires the PiniaColadaDelay or PiniaColadaDelayMutations plugin.
Inherited from
UseMutationEntryExtensions.isDelayingisError
isError: ComputedRef<boolean>;Whether the mutation status is 'error'. TanStack Query compatible property.
Inherited from
UseMutationEntryExtensions.isErrorisIdle
isIdle: ComputedRef<boolean>;Whether the mutation has never been called (status is 'pending' and asyncStatus is 'idle'). TanStack Query compatible property.
Inherited from
UseMutationEntryExtensions.isIdleisLoading
isLoading: ComputedRef<boolean>;Whether the mutation is currently executing.
isPending
isPending: ComputedRef<boolean>;Whether the mutation is currently in progress (asyncStatus === 'loading'). TanStack Query compatible property.
Inherited from
UseMutationEntryExtensions.isPendingisSuccess
isSuccess: ComputedRef<boolean>;Whether the mutation status is 'success'. TanStack Query compatible property.
Inherited from
UseMutationEntryExtensions.isSuccesskey?
optional key:
| EntryKey
| (vars) => EntryKey;mutate()
mutate: (...args) => void;Calls the mutation without returning a promise to avoid unhandled promise rejections.
Parameters
args
...unknown extends TVars ? [] : [TVars]
parameters to pass to the mutation
Returns
void
mutateAsync
mutateAsync: unknown extends TVars ? () => Promise<TData> : (vars) => Promise<TData>;Calls the mutation and returns a promise with the result.
Param
parameters to pass to the mutation
reset()
reset: () => void;Resets the state of the mutation to its initial state.
Returns
void
state
state: ComputedRef<DataState<TData, TError>>;The combined state of the mutation. Contains its data, error, and status. It enables type narrowing based on the ['status'].
status
status: ShallowRef<DataStateStatus>;The status of the mutation.
See
submittedAt
submittedAt: ShallowRef<number>;Timestamp of when the mutation was last submitted. TanStack Query compatible property.
Inherited from
UseMutationEntryExtensions.submittedAtvariables
variables: ShallowRef<TVars | undefined>;The variables passed to the mutation. They are initially undefined and change every time the mutation is called.