Interface: MutationObserverBaseResult<TData, TError, TVariables, TOnMutateResult>#
Defined in: packages/query-core/src/types.ts:1191
Extends#
MutationState<TData,TError,TVariables,TOnMutateResult>
Extended by#
MutationObserverIdleResultMutationObserverLoadingResultMutationObserverErrorResultMutationObserverSuccessResult
Type Parameters#
TData#
TData = unknown
TError#
TError = DefaultError
TVariables#
TVariables = void
TOnMutateResult#
TOnMutateResult = unknown
Properties#
context#
context: TOnMutateResult | undefined;
Defined in: packages/query-core/src/mutation.ts:32
Inherited from#
data#
data: TData | undefined;
Defined in: packages/query-core/src/types.ts:1200
The last successfully resolved data for the mutation.
Overrides#
error#
error: TError | null;
Defined in: packages/query-core/src/types.ts:1209
The error object for the mutation, if an error was encountered.
- Defaults to
null.
Overrides#
failureCount#
failureCount: number;
Defined in: packages/query-core/src/mutation.ts:35
Inherited from#
failureReason#
failureReason: TError | null;
Defined in: packages/query-core/src/mutation.ts:36
Inherited from#
isError#
isError: boolean;
Defined in: packages/query-core/src/types.ts:1214
A boolean variable derived from status.
trueif the last mutation attempt resulted in an error.
isIdle#
isIdle: boolean;
Defined in: packages/query-core/src/types.ts:1219
A boolean variable derived from status.
trueif the mutation is in its initial state prior to executing.
isPaused#
isPaused: boolean;
Defined in: packages/query-core/src/mutation.ts:37
Inherited from#
isPending#
isPending: boolean;
Defined in: packages/query-core/src/types.ts:1224
A boolean variable derived from status.
trueif the mutation is currently executing.
isSuccess#
isSuccess: boolean;
Defined in: packages/query-core/src/types.ts:1229
A boolean variable derived from status.
trueif the last mutation attempt was successful.
mutate#
mutate: MutateFunction<TData, TError, TVariables, TOnMutateResult>;
Defined in: packages/query-core/src/types.ts:1249
The mutation function you can call with variables to trigger the mutation and optionally hooks on additional callback options.
Param#
The variables object to pass to the mutationFn.
Param#
This function will fire when the mutation is successful and will be passed the mutation's result.
Param#
This function will fire if the mutation encounters an error and will be passed the error.
Param#
This function will fire when the mutation is either successfully fetched or encounters an error and be passed either the data or error.
Remarks#
- If you make multiple requests,
onSuccesswill 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.
reset()#
reset: () => void;
Defined in: packages/query-core/src/types.ts:1253
A function to clean the mutation internal state (i.e., it resets the mutation to its initial state).
Returns#
void
status#
status: MutationStatus;
Defined in: packages/query-core/src/types.ts:1238
The status of the mutation.
- Will be:
idleinitial status prior to the mutation function executing.pendingif the mutation is currently executing.errorif the last mutation attempt resulted in an error.successif the last mutation attempt was successful.
Overrides#
submittedAt#
submittedAt: number;
Defined in: packages/query-core/src/mutation.ts:40
Inherited from#
variables#
variables: TVariables | undefined;
Defined in: packages/query-core/src/types.ts:1204
The variables object passed to the mutationFn.