From 5eb0051d4b469a16af50313e06844a81f6546d5b Mon Sep 17 00:00:00 2001 From: Rich Harris Date: Mon, 12 Oct 2026 22:15:59 -0400 Subject: [PATCH] chore: simplify the later-batch check in capture The check for this batch's own dependency values differing from the real ones isn't needed for any test. --- .../svelte/src/internal/client/reactivity/batch.js | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) diff --git a/packages/svelte/src/internal/client/reactivity/batch.js b/packages/svelte/src/internal/client/reactivity/batch.js index ba1c28134f..97bb32fec7 100644 --- a/packages/svelte/src/internal/client/reactivity/batch.js +++ b/packages/svelte/src/internal/client/reactivity/batch.js @@ -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;