Defined in: packages/query-core/src/types.ts:1400
The raw state stored on a Mutation instance. This is the underlying state that observer results (e.g. MutationObserverResult) are derived from.
MutationObserverBaseResult<TData, TError, TVariables, TOnMutateResult>
TData = unknown
TError = DefaultError
TVariables = void
TOnMutateResult = unknown
context: TOnMutateResult | undefined;Defined in: packages/query-core/src/mutation.ts:40
The value returned by onMutate, if defined. Passed to onSuccess, onError and onSettled as the mutation's context.
MutationObserverBaseResult.context
data: undefined;Defined in: packages/query-core/src/types.ts:1411
The last successfully resolved data for the mutation.
MutationObserverBaseResult.data
error: null;Defined in: packages/query-core/src/types.ts:1413
The error object for the mutation, if an error was encountered.
Defaults to null.
MutationObserverBaseResult.error
failureCount: number;Defined in: packages/query-core/src/mutation.ts:53
The number of times the mutation function has failed for the current attempt.
MutationObserverBaseResult.failureCount
failureReason: TError | null;Defined in: packages/query-core/src/mutation.ts:57
The reason the current attempt failed, as reported by the retryer.
MutationObserverBaseResult.failureReason
isError: false;Defined in: packages/query-core/src/types.ts:1414
A boolean variable derived from status.
true if the last mutation attempt resulted in an error.
MutationObserverBaseResult.isError
isIdle: true;Defined in: packages/query-core/src/types.ts:1415
A boolean variable derived from status.
true if the mutation is in its initial state prior to executing.
MutationObserverBaseResult.isIdle
isPaused: boolean;Defined in: packages/query-core/src/mutation.ts:62
Whether the mutation is currently paused (see network mode), or is waiting for another mutation with the same scope to finish.
MutationObserverBaseResult.isPaused
isPending: false;Defined in: packages/query-core/src/types.ts:1416
A boolean variable derived from status.
true if the mutation is currently executing.
MutationObserverBaseResult.isPending
isSuccess: false;Defined in: packages/query-core/src/types.ts:1417
A boolean variable derived from status.
true if the last mutation attempt was successful.
MutationObserverBaseResult.isSuccess
mutate: MutateFunction<TData, TError, TVariables, TOnMutateResult>;Defined in: packages/query-core/src/types.ts:1393
The mutation function you can call with variables to trigger the mutation and optionally hooks on additional callback options.
The variables object to pass to the mutationFn.
This function will fire when the mutation is successful and will be passed the mutation's result.
This function will fire if the mutation encounters an error and will be passed the error.
This function will fire when the mutation is either successfully fetched or encounters an error and be passed either the data or error.
If you make multiple requests, onSuccess will fire only after the latest call you've made.
All the callback functions (onSuccess, onError, onSettled) are void functions, and the returned value will be ignored.
MutationObserverBaseResult.mutate
reset: () => void;Defined in: packages/query-core/src/types.ts:1397
A function to clean the mutation internal state (i.e., it resets the mutation to its initial state).
void
MutationObserverBaseResult.reset
status: "idle";Defined in: packages/query-core/src/types.ts:1418
The status of the mutation.
Will be:
MutationObserverBaseResult.status
submittedAt: number;Defined in: packages/query-core/src/mutation.ts:74
The timestamp for when the mutation was submitted.
MutationObserverBaseResult.submittedAt
variables: undefined;Defined in: packages/query-core/src/types.ts:1412
The variables object passed to the mutationFn.