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