Skip to content

Commit a1e4a0f

Browse files
committed
chore: tweak each block runtime logic
1 parent dcb85a1 commit a1e4a0f

File tree

1 file changed

+5
-4
lines changed
  • packages/svelte/src/internal/client/dom/blocks

1 file changed

+5
-4
lines changed

packages/svelte/src/internal/client/dom/blocks/each.js

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -398,22 +398,23 @@ function reconcile(array, state, anchor, render_fn, flags, get_key) {
398398
to_destroy.push(current);
399399
current = current.next;
400400
}
401+
var destroy_length = to_destroy.length;
401402

402-
if (to_destroy.length > 0) {
403+
if (destroy_length > 0) {
403404
var controlled_anchor = (flags & EACH_IS_CONTROLLED) !== 0 && length === 0 ? anchor : null;
404405

405406
if (is_animated) {
406-
for (i = 0; i < to_destroy.length; i += 1) {
407+
for (i = 0; i < destroy_length; i += 1) {
407408
to_destroy[i].a?.measure();
408409
}
409410

410-
for (i = 0; i < to_destroy.length; i += 1) {
411+
for (i = 0; i < destroy_length; i += 1) {
411412
to_destroy[i].a?.fix();
412413
}
413414
}
414415

415416
pause_effects(to_destroy, controlled_anchor, () => {
416-
for (var i = 0; i < to_destroy.length; i += 1) {
417+
for (var i = 0; i < destroy_length; i += 1) {
417418
var item = to_destroy[i];
418419
items.delete(item.k);
419420
item.o.remove();

0 commit comments

Comments
 (0)