fix: only update lazy properties that have actually changed

pull/10415/head
Dominic Gannaway 3 years ago
parent 90f8b63bee
commit 5446ba81e4

@ -789,7 +789,16 @@ function update_each_item_block(block, item, index, type) {
if ((type & EACH_ITEM_REACTIVE) !== 0) {
set_signal_value(block.v, item);
} else if (is_lazy_property(block.v)) {
block.v.o[block.v.p] = item;
// If we have lazy properties, it means that an array was used that has been
// proxied. Given this, we need to re-sync the old array by mutating the backing
// value to be the latest value to ensure the UI updates correctly. TODO: maybe
// we should bypass any internal mutation checks for this?
const o = block.v.o;
const p = block.v.p;
const prev = o[p];
if (prev !== item) {
o[p] = item;
}
}
const transitions = block.s;
const index_is_reactive = (type & EACH_INDEX_REACTIVE) !== 0;

Loading…
Cancel
Save