From 146716390637bdb13cf5a35858802befd8566eee Mon Sep 17 00:00:00 2001 From: Rich Harris Date: Tue, 26 May 2026 17:12:30 -0400 Subject: [PATCH] tweak --- .../svelte/src/internal/client/reactivity/batch.js | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/packages/svelte/src/internal/client/reactivity/batch.js b/packages/svelte/src/internal/client/reactivity/batch.js index fe73d9234c..21e2cc6922 100644 --- a/packages/svelte/src/internal/client/reactivity/batch.js +++ b/packages/svelte/src/internal/client/reactivity/batch.js @@ -411,10 +411,12 @@ export class Batch { // causing an effect and therefore a root to be scheduled again. We need to traverse the current batch // once more in that case - most of the time this will just clean up dirty branches. if (this.#roots.length > 0) { - next_batch ??= this; - - const batch = next_batch; - batch.#roots.push(...this.#roots.filter((r) => !batch.#roots.includes(r))); + if (next_batch !== null) { + const batch = next_batch; + batch.#roots.push(...this.#roots.filter((r) => !batch.#roots.includes(r))); + } else { + next_batch = this; + } } if (next_batch !== null) {