diff --git a/packages/svelte/src/internal/client/dom/blocks/each.js b/packages/svelte/src/internal/client/dom/blocks/each.js index 646a85b54f..1f6ed81e04 100644 --- a/packages/svelte/src/internal/client/dom/blocks/each.js +++ b/packages/svelte/src/internal/client/dom/blocks/each.js @@ -628,9 +628,13 @@ function reconcile(state, array, anchor, flags, get_key) { var controlled_anchor = (flags & EACH_IS_CONTROLLED) !== 0 && length === 0 ? anchor : null; if (is_animated) { - // Doing all the reads _then_ all the writes minimises layout flushes - for (i = 0; i < destroy_length; i += 1) to_destroy[i].nodes?.a?.measure(); - for (i = 0; i < destroy_length; i += 1) to_destroy[i].nodes?.a?.capture_size(); + // Doing all the reads _then_ all the writes minimises layout flushes. + // `measure` and `capture_size` are both reads, so they share a loop. + for (i = 0; i < destroy_length; i += 1) { + var am = to_destroy[i].nodes?.a; + am?.measure(); + am?.capture_size(); + } for (i = 0; i < destroy_length; i += 1) to_destroy[i].nodes?.a?.set_position(); for (i = 0; i < destroy_length; i += 1) to_destroy[i].nodes?.a?.set_transform(); }