pull/16382/head
Rich Harris 2 months ago
parent 5dee720a4b
commit 6a3d785505

@ -299,6 +299,8 @@ export class Batch {
deactivate() {
current_batch = null;
flush_pending_update();
}
neuter() {
@ -322,13 +324,7 @@ export class Batch {
batches.delete(this);
}
current_batch = null;
for (const update of effect_pending_updates) {
effect_pending_updates.delete(update);
update();
break;
}
this.deactivate();
}
flush_effects() {
@ -429,6 +425,18 @@ export class Batch {
}
}
function flush_pending_update() {
for (const update of effect_pending_updates) {
effect_pending_updates.delete(update);
update();
if (current_batch !== null) {
// only do one at a time
break;
}
}
}
/**
* Synchronously flush any pending updates.
* Returns void if no callback is provided, otherwise returns the result of calling the callback.

Loading…
Cancel
Save