* Builds a new `Mutation` in the `MutationCache` using the observer's * current options, detaches this observer from any previously observed * mutation, attaches it to the new one, and executes it with the given * variables. * * The optional per-call `options` (`onSuccess`/`onError`/`
(
variables: TVariables,
options?: MutateOptions<TData, TError, TVariables, TOnMutateResult>,
)
| 205 | * ``` |
| 206 | */ |
| 207 | mutate( |
| 208 | variables: TVariables, |
| 209 | options?: MutateOptions<TData, TError, TVariables, TOnMutateResult>, |
| 210 | ): Promise<TData> { |
| 211 | this.#mutateOptions = options |
| 212 | |
| 213 | this.#currentMutation?.removeObserver(this) |
| 214 | |
| 215 | this.#currentMutation = this.#client |
| 216 | .getMutationCache() |
| 217 | .build(this.#client, this.options) |
| 218 | |
| 219 | this.#currentMutation.addObserver(this) |
| 220 | |
| 221 | return this.#currentMutation.execute(variables) |
| 222 | } |
| 223 | |
| 224 | #updateResult(): void { |
| 225 | const state = |