|
|
@ -350,8 +350,6 @@ export class Batch {
|
|
|
|
this.#callbacks.clear();
|
|
|
|
this.#callbacks.clear();
|
|
|
|
|
|
|
|
|
|
|
|
if (batches.size > 1) {
|
|
|
|
if (batches.size > 1) {
|
|
|
|
const effects = new Set();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
/**
|
|
|
|
* @param {Value} value
|
|
|
|
* @param {Value} value
|
|
|
|
* @param {Set<Effect>} effects
|
|
|
|
* @param {Set<Effect>} effects
|
|
|
@ -370,18 +368,25 @@ export class Batch {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
for (const source of this.current.keys()) {
|
|
|
|
|
|
|
|
// TODO do we also need block effects?
|
|
|
|
|
|
|
|
get_async_effects(source, effects);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
this.#previous.clear();
|
|
|
|
this.#previous.clear();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
let is_earlier = true;
|
|
|
|
|
|
|
|
|
|
|
|
for (const batch of batches) {
|
|
|
|
for (const batch of batches) {
|
|
|
|
if (batch === this) {
|
|
|
|
if (batch === this) {
|
|
|
|
|
|
|
|
is_earlier = true;
|
|
|
|
continue;
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
const effects = new Set();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
for (const source of this.current.keys()) {
|
|
|
|
|
|
|
|
if (is_earlier && batch.current.has(source)) continue;
|
|
|
|
|
|
|
|
// TODO do we also need block effects?
|
|
|
|
|
|
|
|
get_async_effects(source, effects);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (effects.size > 0) {
|
|
|
|
current_batch = batch;
|
|
|
|
current_batch = batch;
|
|
|
|
const revert = Batch.apply(batch);
|
|
|
|
const revert = Batch.apply(batch);
|
|
|
|
for (const e of effects) {
|
|
|
|
for (const e of effects) {
|
|
|
@ -389,6 +394,7 @@ export class Batch {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
revert();
|
|
|
|
revert();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
current_batch = null;
|
|
|
|
current_batch = null;
|
|
|
|
}
|
|
|
|
}
|
|
|
|