pull/10798/head
Rich Harris 2 years ago
parent d9b088f130
commit 4a2c92571a

@ -391,28 +391,22 @@ function reconcile_tracked_array(array, each_block, dom, is_controlled, render_f
// Step 1 — trim from the end // Step 1 — trim from the end
while (a > 0 && b > 0 && a_blocks[a - 1].k === keys[b - 1]) { while (a > 0 && b > 0 && a_blocks[a - 1].k === keys[b - 1]) {
a -= 1; block = b_blocks[--b] = a_blocks[--a];
b -= 1; sibling = get_first_child(block);
block = a_blocks[a];
if (should_update) { if (should_update) {
update_block(block, array[b], b, flags); update_block(block, array[b], b, flags);
} }
sibling = get_first_child(block);
b_blocks[b] = block;
} }
// Step 2 — trim from the start // Step 2 — trim from the start
while (start < a && start < b && a_blocks[start].k === keys[start]) { while (start < a && start < b && a_blocks[start].k === keys[start]) {
block = a_blocks[start]; block = b_blocks[start] = a_blocks[start];
if (should_update) { if (should_update) {
update_block(block, array[start], start, flags); update_block(block, array[start], start, flags);
} }
b_blocks[start] = block;
start += 1; start += 1;
} }

Loading…
Cancel
Save