Skip to content

Commit 9fb907a

Browse files
committed
chore: more tweaks to each block performance
1 parent ef2d378 commit 9fb907a

File tree

1 file changed

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

1 file changed

+10
-5
lines changed

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

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -57,9 +57,9 @@ export function index(_, i) {
5757
* subsequent destruction. Used in each blocks
5858
* @param {import('#client').EachItem[]} items
5959
* @param {null | Node} controlled_anchor
60-
* @param {() => void} [callback]
60+
* @param {Map<any, import("#client").EachItem>} items_map
6161
*/
62-
function pause_effects(items, controlled_anchor, callback) {
62+
function pause_effects(items, controlled_anchor, items_map) {
6363
/** @type {import('#client').TransitionManager[]} */
6464
var transitions = [];
6565
var length = items.length;
@@ -81,10 +81,11 @@ function pause_effects(items, controlled_anchor, callback) {
8181

8282
run_out_transitions(transitions, () => {
8383
for (var i = 0; i < length; i++) {
84-
destroy_effect(items[i].e, !is_controlled);
84+
var item = items[i];
85+
items_map.delete(item.k);
86+
link(item.prev, item.next);
87+
destroy_effect(item.e, !is_controlled);
8588
}
86-
87-
if (callback !== undefined) callback();
8889
});
8990
}
9091

@@ -413,6 +414,7 @@ function reconcile(array, state, anchor, render_fn, flags, get_key) {
413414
}
414415
}
415416

417+
<<<<<<< Updated upstream
416418
pause_effects(to_destroy, controlled_anchor, () => {
417419
for (var i = 0; i < destroy_length; i += 1) {
418420
var item = to_destroy[i];
@@ -421,6 +423,9 @@ function reconcile(array, state, anchor, render_fn, flags, get_key) {
421423
link(item.prev, item.next);
422424
}
423425
});
426+
=======
427+
pause_effects(to_destroy, controlled_anchor, items);
428+
>>>>>>> Stashed changes
424429
}
425430

426431
if (is_animated) {

0 commit comments

Comments
 (0)