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

Method runNext

packages/query-core/src/mutationCache.ts:251–262  ·  view source on GitHub ↗

* Continues the next paused mutation in the same `scope` after a mutation finishes. * @internal * @param mutation - The mutation that finished. * @returns A promise that resolves once the next paused mutation in the same scope has continued, * or immediately if there is none.

(mutation: Mutation<any, any, any, any>)

Source from the content-addressed store, hash-verified

249 * or immediately if there is none.
250 */
251 runNext(mutation: Mutation<any, any, any, any>): Promise<unknown> {
252 const scope = scopeFor(mutation)
253 if (typeof scope === 'string') {
254 const foundMutation = this.#scopes
255 .get(scope)
256 ?.find((m) => m !== mutation && m.state.isPaused)
257
258 return foundMutation?.continue() ?? Promise.resolve()
259 } else {
260 return Promise.resolve()
261 }
262 }
263
264 /**
265 * Removes all mutations and clears their garbage collection timers.

Callers 1

executeMethod · 0.80

Calls 4

scopeForFunction · 0.85
getMethod · 0.80
continueMethod · 0.80
findMethod · 0.45

Tested by

no test coverage detected