()
| 274 | } |
| 275 | |
| 276 | #process() { |
| 277 | this.#started = true; |
| 278 | |
| 279 | if (flush_count++ > 1000) { |
| 280 | this.#unlink(); |
| 281 | infinite_loop_guard(); |
| 282 | } |
| 283 | |
| 284 | if (DEV) { |
| 285 | // track all the values that were updated during this flush, |
| 286 | // so that they can be reset afterwards |
| 287 | for (const value of this.current.keys()) { |
| 288 | source_stacks.add(value); |
| 289 | } |
| 290 | } |
| 291 | |
| 292 | // We always reschedule previously-deferred effects, not just when |
| 293 | // #is_deferred() is true, because traversing the tree could make |
| 294 | // an if block that contains the last blocking pending effect falsy, |
| 295 | // causing the block to no longer be deferred. |
| 296 | for (const e of this.#dirty_effects) { |
| 297 | this.#maybe_dirty_effects.delete(e); |
| 298 | set_signal_status(e, DIRTY); |
| 299 | this.schedule(e); |
| 300 | } |
| 301 | |
| 302 | for (const e of this.#maybe_dirty_effects) { |
| 303 | set_signal_status(e, MAYBE_DIRTY); |
| 304 | this.schedule(e); |
| 305 | } |
| 306 | |
| 307 | const roots = this.#roots; |
| 308 | this.#roots = []; |
| 309 | |
| 310 | this.apply(); |
| 311 | |
| 312 | /** @type {Effect[]} */ |
| 313 | var effects = (collected_effects = []); |
| 314 | |
| 315 | /** @type {Effect[]} */ |
| 316 | var render_effects = []; |
| 317 | |
| 318 | /** |
| 319 | * @type {Effect[]} |
| 320 | * @deprecated when we get rid of legacy mode and stores, we can get rid of this |
| 321 | */ |
| 322 | var updates = (legacy_updates = []); |
| 323 | |
| 324 | for (const root of roots) { |
| 325 | try { |
| 326 | this.#traverse(root, effects, render_effects); |
| 327 | } catch (e) { |
| 328 | reset_all(root); |
| 329 | // If there's no async work left, this branch is now dead and needs |
| 330 | // to be discarded to not become a zombie that is never cleaned up. |
| 331 | // See https://github.com/sveltejs/svelte/issues/18221#issuecomment-4497918414 |
| 332 | // for a (non-minimal) reproduction that demonstrates a case where this is necessary |
| 333 | // to not get follow-up false-positives via "batch has scheduled roots" invariant errors. |
no test coverage detected