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

Method runNext

packages/query-core/src/mutationCache.ts:240–251  ·  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

238 * or immediately if there is none.
239 */
240 runNext(mutation: Mutation<any, any, any, any>): Promise<unknown> {
241 const scope = scopeFor(mutation)
242 if (typeof scope === 'string') {
243 const foundMutation = this.#scopes
244 .get(scope)
245 ?.find((m) => m !== mutation && m.state.isPaused)
246
247 return foundMutation?.continue() ?? Promise.resolve()
248 } else {
249 return Promise.resolve()
250 }
251 }
252
253 /**
254 * Removes all mutations from the cache.

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