MCPcopy
hub / github.com/TanStack/query / mutate

Method mutate

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

Source from the content-addressed store, hash-verified

126 }
127
128 mutate(
129 variables: TVariables,
130 options?: MutateOptions<TData, TError, TVariables, TOnMutateResult>,
131 ): Promise<TData> {
132 this.#mutateOptions = options
133
134 this.#currentMutation?.removeObserver(this)
135
136 this.#currentMutation = this.#client
137 .getMutationCache()
138 .build(this.#client, this.options)
139
140 this.#currentMutation.addObserver(this)
141
142 return this.#currentMutation.execute(variables)
143 }
144
145 #updateResult(): void {
146 const state =

Callers 15

createMutationFunction · 0.95
mutateFunction · 0.45
useMutationFunction · 0.45
PageFunction · 0.45
ComponentFunction · 0.45
mutateFunction · 0.45
useQueriesFunction · 0.45
subscribeToObserverFunction · 0.45
MutateFunction · 0.45
PageFunction · 0.45
MutatesFunction · 0.45

Calls 5

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

Tested by 6

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