run-batch-until-complete
Rich Harris 5 days ago
parent 18ecf01382
commit 739f5fc1c6

@ -182,8 +182,6 @@ export class Batch {
#traverse_effect_tree(root) { #traverse_effect_tree(root) {
root.f ^= CLEAN; root.f ^= CLEAN;
var should_defer = false;
/** @type {EffectTarget} */ /** @type {EffectTarget} */
var target = { var target = {
parent: null, parent: null,
@ -236,25 +234,15 @@ export class Batch {
effect = effect.next; effect = effect.next;
while (effect === null && parent !== null) { while (effect === null && parent !== null) {
if (parent.b !== null) { if (parent === target.effect) {
var ready = parent.b.local_pending_count === 0; // TODO rather than traversing into pending boundaries and deferring the effects,
// could we just attach the effects _to_ the pending boundary and schedule them
if (target.parent === null) { // once the boundary is ready?
should_defer ||= !ready; this.#defer_effects(target.effects);
} else if (parent === target.effect) { this.#defer_effects(target.render_effects);
if (ready) { this.#defer_effects(target.block_effects);
// TODO can this happen?
target.parent.effects.push(...target.effects); target = /** @type {EffectTarget} */ (target.parent);
target.parent.render_effects.push(...target.render_effects);
target.parent.block_effects.push(...target.block_effects);
} else {
this.#defer_effects(target.effects);
this.#defer_effects(target.render_effects);
this.#defer_effects(target.block_effects);
}
target = /** @type {EffectTarget} */ (target.parent);
}
} }
effect = parent.next; effect = parent.next;

Loading…
Cancel
Save