|
|
|
|
@ -741,20 +741,15 @@ export class Batch {
|
|
|
|
|
// A later batch may also own a newer value of the source or one of a derived's dependencies.
|
|
|
|
|
// The check above isn't sufficient here: a later batch's write is visible through `batch_values`,
|
|
|
|
|
// so comparing what was read against the real value could not attribute the value to the right
|
|
|
|
|
// batch, see `async-dont-rebase-new-batch-4`. We only need to look one level deep: `is_dirty`
|
|
|
|
|
// evaluates the top-most deriveds first, so a dependency derived that was itself not the latest
|
|
|
|
|
// value was not written to the real world, and differs from our value for it.
|
|
|
|
|
|
|
|
|
|
// batch, see `async-dont-rebase-new-batch-4`.
|
|
|
|
|
for (let batch = this.next; batch !== null && is_latest_value; batch = batch.next) {
|
|
|
|
|
if (batch.is_fork) continue;
|
|
|
|
|
|
|
|
|
|
if (
|
|
|
|
|
batch.current.has(source) ||
|
|
|
|
|
((source.f & DERIVED) !== 0 &&
|
|
|
|
|
/** @type {Derived} */ (source).deps?.some(
|
|
|
|
|
(d) =>
|
|
|
|
|
/** @type {Batch} */ (batch).current.has(d) ||
|
|
|
|
|
(this.current.has(d) && /** @type {{ v: any }} */ (this.current.get(d)).v !== d.v)
|
|
|
|
|
/** @type {Derived} */ (source).deps?.some((d) =>
|
|
|
|
|
/** @type {Batch} */ (batch).current.has(d)
|
|
|
|
|
))
|
|
|
|
|
) {
|
|
|
|
|
is_latest_value = false;
|
|
|
|
|
|