* 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>)
| 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. |