From 8f8de5030b7b0f7e11c92b1b2d7b324d9a05d02d Mon Sep 17 00:00:00 2001 From: Rich Harris Date: Sat, 15 Nov 2025 12:56:23 -0500 Subject: [PATCH] better comment --- packages/svelte/src/internal/client/dom/blocks/each.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/packages/svelte/src/internal/client/dom/blocks/each.js b/packages/svelte/src/internal/client/dom/blocks/each.js index 67cf46eff7..3cd20bc002 100644 --- a/packages/svelte/src/internal/client/dom/blocks/each.js +++ b/packages/svelte/src/internal/client/dom/blocks/each.js @@ -80,8 +80,9 @@ function pause_effects(state, to_destroy, controlled_anchor) { } run_out_transitions(transitions, () => { - // If we have a controlled anchor, it means that the each block is inside a single - // DOM element, so we can apply a fast-path for clearing the contents of the element. + // If we're in a controlled each block (i.e. the block is the only child of an + // element), and we are removing all items, _and_ there are no out transitions, + // we can use the fast path — emptying the element and replacing the anchor var fast_path = transitions.length === 0 && controlled_anchor !== null; // TODO only destroy effects if no pending batch needs them. otherwise,