|
|
|
|
@ -338,10 +338,6 @@ export class Batch {
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (this.#pending === 0) {
|
|
|
|
|
batches.delete(this);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// clear effects. Those that are still needed will be rescheduled through unskipping the skipped branches.
|
|
|
|
|
this.#dirty_effects.clear();
|
|
|
|
|
this.#maybe_dirty_effects.clear();
|
|
|
|
|
@ -363,7 +359,7 @@ export class Batch {
|
|
|
|
|
// else we could start flushing a new batch and then, if it has pending work, rebase it right afterwards, which is wrong.
|
|
|
|
|
// In sync mode flushSync can cause #commit to wrongfully think that there needs to be a rebase, so we only do it in async mode
|
|
|
|
|
// TODO fix the underlying cause, otherwise this will likely regress when non-async mode is removed
|
|
|
|
|
if (async_mode_flag && !batches.has(this)) {
|
|
|
|
|
if (async_mode_flag && this.#pending === 0) {
|
|
|
|
|
this.#commit();
|
|
|
|
|
// Rebases can activate other batches or null it out, therefore restore the new one here
|
|
|
|
|
current_batch = next_batch;
|
|
|
|
|
@ -527,6 +523,8 @@ export class Batch {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
#commit() {
|
|
|
|
|
batches.delete(this);
|
|
|
|
|
|
|
|
|
|
// If there are other pending batches, they now need to be 'rebased' —
|
|
|
|
|
// in other words, we re-run block/async effects with the newly
|
|
|
|
|
// committed state, unless the batch in question has a more
|
|
|
|
|
|