Skip to content

Commit e7a1c3a

Browse files
committed
avoid mutating lookup
1 parent ca14930 commit e7a1c3a

File tree

1 file changed

+6
-3
lines changed
  • packages/svelte/src/internal/client/dom/blocks

1 file changed

+6
-3
lines changed

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

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -327,7 +327,7 @@ function reconcile(array, state, anchor, render_fn, flags, get_key) {
327327
// more efficient to move earlier items to the back
328328
const a = current ? get_first_child(current) : anchor;
329329

330-
lookup.delete(key);
330+
seen.delete(item);
331331
move(item, prev, a);
332332

333333
prev = item;
@@ -355,11 +355,14 @@ function reconcile(array, state, anchor, render_fn, flags, get_key) {
355355
matched.push(item);
356356
prev = item;
357357
current = item.next;
358+
}
358359

359-
lookup.delete(key);
360+
while (current) {
361+
seen.add(current);
362+
current = current.next;
360363
}
361364

362-
const to_destroy = Array.from(lookup.values());
365+
const to_destroy = Array.from(seen);
363366

364367
pause_effects(
365368
to_destroy.map((item) => item.e),

0 commit comments

Comments
 (0)