chore: remove inert check from each block reconciliation (#15143)

pull/15159/head
Rich Harris 7 months ago committed by GitHub
parent 674f81b5ce
commit 2be3823e3a
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

@ -219,17 +219,7 @@ export function each(node, flags, get_collection, get_key, render_fn, fallback_f
} }
if (!hydrating) { if (!hydrating) {
var effect = /** @type {Effect} */ (active_reaction); reconcile(array, state, anchor, render_fn, flags, get_key, get_collection);
reconcile(
array,
state,
anchor,
render_fn,
flags,
(effect.f & INERT) !== 0,
get_key,
get_collection
);
} }
if (fallback_fn !== null) { if (fallback_fn !== null) {
@ -273,12 +263,11 @@ export function each(node, flags, get_collection, get_key, render_fn, fallback_f
* @param {Element | Comment | Text} anchor * @param {Element | Comment | Text} anchor
* @param {(anchor: Node, item: MaybeSource<V>, index: number | Source<number>, collection: () => V[]) => void} render_fn * @param {(anchor: Node, item: MaybeSource<V>, index: number | Source<number>, collection: () => V[]) => void} render_fn
* @param {number} flags * @param {number} flags
* @param {boolean} is_inert
* @param {(value: V, index: number) => any} get_key * @param {(value: V, index: number) => any} get_key
* @param {() => V[]} get_collection * @param {() => V[]} get_collection
* @returns {void} * @returns {void}
*/ */
function reconcile(array, state, anchor, render_fn, flags, is_inert, get_key, get_collection) { function reconcile(array, state, anchor, render_fn, flags, get_key, get_collection) {
var is_animated = (flags & EACH_IS_ANIMATED) !== 0; var is_animated = (flags & EACH_IS_ANIMATED) !== 0;
var should_update = (flags & (EACH_ITEM_REACTIVE | EACH_INDEX_REACTIVE)) !== 0; var should_update = (flags & (EACH_ITEM_REACTIVE | EACH_INDEX_REACTIVE)) !== 0;
@ -420,7 +409,7 @@ function reconcile(array, state, anchor, render_fn, flags, is_inert, get_key, ge
while (current !== null && current.k !== key) { while (current !== null && current.k !== key) {
// If the each block isn't inert and an item has an effect that is already inert, // If the each block isn't inert and an item has an effect that is already inert,
// skip over adding it to our seen Set as the item is already being handled // skip over adding it to our seen Set as the item is already being handled
if (is_inert || (current.e.f & INERT) === 0) { if ((current.e.f & INERT) === 0) {
(seen ??= new Set()).add(current); (seen ??= new Set()).add(current);
} }
stashed.push(current); stashed.push(current);
@ -444,7 +433,7 @@ function reconcile(array, state, anchor, render_fn, flags, is_inert, get_key, ge
while (current !== null) { while (current !== null) {
// If the each block isn't inert, then inert effects are currently outroing and will be removed once the transition is finished // If the each block isn't inert, then inert effects are currently outroing and will be removed once the transition is finished
if (is_inert || (current.e.f & INERT) === 0) { if ((current.e.f & INERT) === 0) {
to_destroy.push(current); to_destroy.push(current);
} }
current = current.next; current = current.next;

Loading…
Cancel
Save