chore: tweak each block runtime logic (#11862)

* chore: tweak each block runtime logic
pull/11863/head
Dominic Gannaway 1 year ago committed by GitHub
parent fb57c20f28
commit ef2d378b67
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

@ -394,31 +394,34 @@ function reconcile(array, state, anchor, render_fn, flags, get_key) {
const to_destroy = Array.from(seen); const to_destroy = Array.from(seen);
while (current) { while (current !== null) {
to_destroy.push(current); to_destroy.push(current);
current = current.next; current = current.next;
} }
var destroy_length = to_destroy.length;
var controlled_anchor = (flags & EACH_IS_CONTROLLED) !== 0 && length === 0 ? anchor : null; if (destroy_length > 0) {
var controlled_anchor = (flags & EACH_IS_CONTROLLED) !== 0 && length === 0 ? anchor : null;
if (is_animated) { if (is_animated) {
for (i = 0; i < to_destroy.length; i += 1) { for (i = 0; i < destroy_length; i += 1) {
to_destroy[i].a?.measure(); to_destroy[i].a?.measure();
} }
for (i = 0; i < to_destroy.length; i += 1) { for (i = 0; i < destroy_length; i += 1) {
to_destroy[i].a?.fix(); to_destroy[i].a?.fix();
}
} }
}
pause_effects(to_destroy, controlled_anchor, () => { pause_effects(to_destroy, controlled_anchor, () => {
for (var i = 0; i < to_destroy.length; i += 1) { for (var i = 0; i < destroy_length; i += 1) {
var item = to_destroy[i]; var item = to_destroy[i];
items.delete(item.k); items.delete(item.k);
item.o.remove(); item.o.remove();
link(item.prev, item.next); link(item.prev, item.next);
} }
}); });
}
if (is_animated) { if (is_animated) {
effect(() => { effect(() => {

Loading…
Cancel
Save