* 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>,
)
| 215 | * ``` |
| 216 | */ |
| 217 | mutate( |
| 218 | variables: TVariables, |
| 219 | options?: MutateOptions<TData, TError, TVariables, TOnMutateResult>, |
| 220 | ): Promise<TData> { |
| 221 | this.#mutateOptions = options |
| 222 | |
| 223 | this.#currentMutation?.removeObserver(this) |
| 224 | |
| 225 | this.#currentMutation = this.#client |
| 226 | .getMutationCache() |
| 227 | .build(this.#client, this.options) |
| 228 | |
| 229 | this.#currentMutation.addObserver(this) |
| 230 | |
| 231 | return this.#currentMutation.execute(variables) |
| 232 | } |
| 233 | |
| 234 | #updateResult(): void { |
| 235 | const state = |