* Traverse the effect tree, executing effects or stashing * them for later execution as appropriate * @param {Effect} root * @param {Effect[]} effects * @param {Effect[]} render_effects
(root, effects, render_effects)
| 432 | * @param {Effect[]} render_effects |
| 433 | */ |
| 434 | #traverse(root, effects, render_effects) { |
| 435 | root.f ^= CLEAN; |
| 436 | |
| 437 | var effect = root.first; |
| 438 | |
| 439 | while (effect !== null) { |
| 440 | var flags = effect.f; |
| 441 | var is_branch = (flags & (BRANCH_EFFECT | ROOT_EFFECT)) !== 0; |
| 442 | var is_skippable_branch = is_branch && (flags & CLEAN) !== 0; |
| 443 | |
| 444 | var skip = is_skippable_branch || (flags & INERT) !== 0 || this.#skipped_branches.has(effect); |
| 445 | |
| 446 | if (!skip && effect.fn !== null) { |
| 447 | if (is_branch) { |
| 448 | effect.f ^= CLEAN; |
| 449 | } else if ((flags & EFFECT) !== 0) { |
| 450 | effects.push(effect); |
| 451 | } else if (async_mode_flag && (flags & (RENDER_EFFECT | MANAGED_EFFECT)) !== 0) { |
| 452 | render_effects.push(effect); |
| 453 | } else if (is_dirty(effect)) { |
| 454 | if ((flags & BLOCK_EFFECT) !== 0) this.#maybe_dirty_effects.add(effect); |
| 455 | update_effect(effect); |
| 456 | } |
| 457 | |
| 458 | var child = effect.first; |
| 459 | |
| 460 | if (child !== null) { |
| 461 | effect = child; |
| 462 | continue; |
| 463 | } |
| 464 | } |
| 465 | |
| 466 | while (effect !== null) { |
| 467 | var next = effect.next; |
| 468 | |
| 469 | if (next !== null) { |
| 470 | effect = next; |
| 471 | break; |
| 472 | } |
| 473 | |
| 474 | effect = effect.parent; |
| 475 | } |
| 476 | } |
| 477 | } |
| 478 | |
| 479 | #find_earlier_batch() { |
| 480 | var batch = this.#prev; |