* Creates a mutation and adds it to the cache. * @internal * @param client - The client the mutation belongs to, used to default its options. * @param options - The mutation options. They are defaulted with * QueryClient#defaultMutationOptions. * @param state - The initial sta
(
client: QueryClient,
options: MutationOptions<TData, TError, TVariables, TOnMutateResult>,
state?: MutationState<TData, TError, TVariables, TOnMutateResult>,
)
| 142 | * @returns The new mutation, already added to the cache. |
| 143 | */ |
| 144 | build<TData, TError, TVariables, TOnMutateResult>( |
| 145 | client: QueryClient, |
| 146 | options: MutationOptions<TData, TError, TVariables, TOnMutateResult>, |
| 147 | state?: MutationState<TData, TError, TVariables, TOnMutateResult>, |
| 148 | ): Mutation<TData, TError, TVariables, TOnMutateResult> { |
| 149 | const mutation = new Mutation({ |
| 150 | client, |
| 151 | mutationCache: this, |
| 152 | mutationId: ++this.#mutationId, |
| 153 | options: client.defaultMutationOptions(options), |
| 154 | state, |
| 155 | }) |
| 156 | |
| 157 | this.add(mutation) |
| 158 | |
| 159 | return mutation |
| 160 | } |
| 161 | |
| 162 | /** |
| 163 | * Adds a mutation to the cache. |
nothing calls this directly
no test coverage detected