chore: more tweaks to each block performance (#11863)

* chore: more tweaks to each block performance

* chore: more tweaks to each block performance
pull/11864/head
Dominic Gannaway 1 year ago committed by GitHub
parent ef2d378b67
commit 7429e544cc
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

@ -57,9 +57,9 @@ export function index(_, i) {
* subsequent destruction. Used in each blocks
* @param {import('#client').EachItem[]} items
* @param {null | Node} controlled_anchor
* @param {() => void} [callback]
* @param {Map<any, import("#client").EachItem>} items_map
*/
function pause_effects(items, controlled_anchor, callback) {
function pause_effects(items, controlled_anchor, items_map) {
/** @type {import('#client').TransitionManager[]} */
var transitions = [];
var length = items.length;
@ -81,10 +81,11 @@ function pause_effects(items, controlled_anchor, callback) {
run_out_transitions(transitions, () => {
for (var i = 0; i < length; i++) {
destroy_effect(items[i].e, !is_controlled);
var item = items[i];
items_map.delete(item.k);
link(item.prev, item.next);
destroy_effect(item.e, !is_controlled);
}
if (callback !== undefined) callback();
});
}
@ -413,14 +414,7 @@ function reconcile(array, state, anchor, render_fn, flags, get_key) {
}
}
pause_effects(to_destroy, controlled_anchor, () => {
for (var i = 0; i < destroy_length; i += 1) {
var item = to_destroy[i];
items.delete(item.k);
item.o.remove();
link(item.prev, item.next);
}
});
pause_effects(to_destroy, controlled_anchor, items);
}
if (is_animated) {

Loading…
Cancel
Save