Skip to content

Commit f6e2fa9

Browse files
committed
fix
1 parent 8dba71d commit f6e2fa9

File tree

1 file changed

+23
-16
lines changed
  • packages/svelte/src/internal/client/dom/blocks

1 file changed

+23
-16
lines changed

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

Lines changed: 23 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -291,6 +291,9 @@ function reconcile(array, state, anchor, render_fn, flags, get_key) {
291291
flags
292292
);
293293

294+
matched = [];
295+
stashed = [];
296+
294297
current = prev.next;
295298
continue;
296299
}
@@ -325,27 +328,31 @@ function reconcile(array, state, anchor, render_fn, flags, get_key) {
325328

326329
lookup.delete(key);
327330
move(item, prev, a);
328-
}
329-
} else {
330-
while (current && current.k !== key) {
331-
seen.add(current);
332-
stashed.push(current);
333-
current = current.next;
334-
}
335331

336-
if (current) {
337-
matched.push(current);
338-
current = item.next;
339332
prev = item;
340-
lookup.delete(key);
341333
}
334+
335+
continue;
342336
}
343-
} else {
344-
matched.push(current);
345-
current = item.next;
346-
prev = item;
347-
lookup.delete(key);
337+
338+
while (current && current.k !== key) {
339+
seen.add(current);
340+
stashed.push(current);
341+
current = current.next;
342+
}
343+
344+
if (current === null) {
345+
continue;
346+
}
347+
348+
item = current;
348349
}
350+
351+
matched.push(item);
352+
prev = item;
353+
current = item.next;
354+
355+
lookup.delete(key);
349356
}
350357

351358
const to_destroy = Array.from(lookup.values());

0 commit comments

Comments
 (0)