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

Function mutateAsync

packages/angular-query/src/inject-mutation.ts:211–234  ·  view source on GitHub ↗
(...args)

Source from the content-addressed store, hash-verified

209 TVariables,
210 TOnMutateResult
211 > = (...args) => {
212 return outsideZone(() =>
213 untracked(() => {
214 const observer = observerSignal()
215 observer.setOptions(optionsSignal())
216 pendingInvocations++
217 lifecycle.setPending(true)
218 // Track invocations, not the observer's latest result: reset or a later
219 // mutation completing must not release work which is still running.
220 const settled = () => {
221 pendingInvocations--
222 lifecycle.setPending(pendingInvocations > 0)
223 }
224 try {
225 return observer
226 .mutate(args[0] as TVariables, args[1])
227 .finally(settled)
228 } catch (error) {
229 settled()
230 throw error
231 }
232 }),
233 )
234 }
235
236 const reset = () => {
237 outsideZone(() =>

Callers 3

PageFunction · 0.85
PageFunction · 0.85
mutateFunction · 0.85

Calls 3

settledFunction · 0.85
setOptionsMethod · 0.45
mutateMethod · 0.45

Tested by 2

PageFunction · 0.68
PageFunction · 0.68