pull/17150/head
Rich Harris 1 week ago
parent e075fb2ede
commit 8069458e25

@ -81,6 +81,7 @@ function pause_effects(state, items, controlled_anchor) {
} }
var is_controlled = length > 0 && transitions.length === 0 && controlled_anchor !== null; var is_controlled = length > 0 && transitions.length === 0 && controlled_anchor !== null;
// If we have a controlled anchor, it means that the each block is inside a single // If we have a controlled anchor, it means that the each block is inside a single
// DOM element, so we can apply a fast-path for clearing the contents of the element. // DOM element, so we can apply a fast-path for clearing the contents of the element.
if (is_controlled) { if (is_controlled) {
@ -90,7 +91,6 @@ function pause_effects(state, items, controlled_anchor) {
clear_text_content(parent_node); clear_text_content(parent_node);
parent_node.append(/** @type {Element} */ (controlled_anchor)); parent_node.append(/** @type {Element} */ (controlled_anchor));
state.onscreen.clear(); state.onscreen.clear();
link(state, items[0].prev, items[length - 1].next);
} }
run_out_transitions(transitions, () => { run_out_transitions(transitions, () => {
@ -98,11 +98,13 @@ function pause_effects(state, items, controlled_anchor) {
var item = items[i]; var item = items[i];
if (!is_controlled) { if (!is_controlled) {
state.onscreen.delete(item.k); state.onscreen.delete(item.k);
link(state, item.prev, item.next);
} }
destroy_effect(item.e, !is_controlled); destroy_effect(item.e, !is_controlled);
} }
}); });
link(state, items[0].prev, items[length - 1].next);
} }
/** /**
@ -231,7 +233,6 @@ export function each(node, flags, get_collection, get_key, render_fn, fallback_f
batch.skipped_effects.delete(item.e); batch.skipped_effects.delete(item.e);
} else { } else {
console.log('creating', key);
item = create_item( item = create_item(
first_run ? (hydrating ? hydrate_node : anchor) : null, first_run ? (hydrating ? hydrate_node : anchor) : null,
state, state,
@ -634,7 +635,7 @@ function create_item(
if (prev === null) { if (prev === null) {
if (!deferred) { if (!deferred) {
// TODO move this into block effect? // TODO move this into block effect?
state.first = item; // state.first = item;
} }
} else { } else {
prev.next = item; prev.next = item;

Loading…
Cancel
Save