MCPcopy Create free account
hub / github.com/TanStack/query / mutate

Method mutate

packages/query-core/src/mutationObserver.ts:136–151  ·  view source on GitHub ↗
(
    variables: TVariables,
    options?: MutateOptions<TData, TError, TVariables, TOnMutateResult>,
  )

Source from the content-addressed store, hash-verified

134 }
135
136 mutate(
137 variables: TVariables,
138 options?: MutateOptions<TData, TError, TVariables, TOnMutateResult>,
139 ): Promise<TData> {
140 this.#mutateOptions = options
141
142 this.#currentMutation?.removeObserver(this)
143
144 this.#currentMutation = this.#client
145 .getMutationCache()
146 .build(this.#client, this.options)
147
148 this.#currentMutation.addObserver(this)
149
150 return this.#currentMutation.execute(variables)
151 }
152
153 #updateResult(): void {
154 const state =

Callers 15

MutationControllerClass · 0.45
mutateFunction · 0.45
useMutationFunction · 0.45
PageFunction · 0.45
ComponentFunction · 0.45
useMutationFunction · 0.45
PageFunction · 0.45
ComponentFunction · 0.45

Calls 5

getMutationCacheMethod · 0.80
executeMethod · 0.80
removeObserverMethod · 0.45
buildMethod · 0.45
addObserverMethod · 0.45

Tested by 8

PageFunction · 0.36
ComponentFunction · 0.36
PageFunction · 0.36
ComponentFunction · 0.36
MutateFunction · 0.36
PageFunction · 0.36
MutatesFunction · 0.36
ComponentFunction · 0.36