|
|
|
@ -216,15 +216,6 @@ export class Batch {
|
|
|
|
|
flush_queued_effects(render_effects);
|
|
|
|
|
flush_queued_effects(effects);
|
|
|
|
|
|
|
|
|
|
// Reinstate the current batch if there was no new one created, as `process()` runs in a loop in `flush_effects()`.
|
|
|
|
|
// That method expects `current_batch` to be set, and could run the loop again if effects result in new effects
|
|
|
|
|
// being scheduled but without writes happening in which case no new batch is created.
|
|
|
|
|
if (current_batch === null) {
|
|
|
|
|
current_batch = this;
|
|
|
|
|
} else {
|
|
|
|
|
batches.delete(this);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
this.#deferred?.resolve();
|
|
|
|
|
} else {
|
|
|
|
|
this.#defer_effects(this.#render_effects);
|
|
|
|
@ -364,22 +355,20 @@ export class Batch {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
flush() {
|
|
|
|
|
this.activate();
|
|
|
|
|
|
|
|
|
|
if (queued_root_effects.length > 0) {
|
|
|
|
|
flush_effects();
|
|
|
|
|
} else {
|
|
|
|
|
} else if (this.#pending === 0) {
|
|
|
|
|
this.#commit();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (current_batch !== this) {
|
|
|
|
|
if (current_batch !== null && current_batch !== this) {
|
|
|
|
|
// this can happen if a `flushSync` occurred during `flush_effects()`,
|
|
|
|
|
// which is permitted in legacy mode despite being a terrible idea
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (this.#pending === 0) {
|
|
|
|
|
batches.delete(this);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
this.deactivate();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -394,6 +383,7 @@ export class Batch {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
this.#callbacks.clear();
|
|
|
|
|
batches.delete(this);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
increment() {
|
|
|
|
|