fix other issues

fix-each-block-duplications
Dominic Gannaway 6 months ago
parent 194399d67f
commit da11d21a56

@ -59,7 +59,7 @@ function pause_effects(items, paused, controlled_anchor) {
transitions_count = transitions.length; transitions_count = transitions.length;
pause_children(item.e, transitions, true); pause_children(item.e, transitions, true);
if (transitions_count !== transitions.length) { if (transitions_count !== transitions.length) {
paused.set(item.k === null ? item.i : item.k, item); paused.set(item.k, item);
} }
} }
@ -75,7 +75,7 @@ function pause_effects(items, paused, controlled_anchor) {
run_out_transitions(transitions, () => { run_out_transitions(transitions, () => {
for (var i = 0; i < length; i++) { for (var i = 0; i < length; i++) {
paused.delete(item.k === null ? item.i : item.k); paused.delete(item.k);
destroy_effect(items[i].e); destroy_effect(items[i].e);
} }
}); });
@ -266,6 +266,8 @@ function reconcile_indexed_array(array, state, anchor, render_fn, flags) {
value = array[i]; value = array[i];
item = a_items[i]; item = a_items[i];
b_items[i] = item; b_items[i] = item;
// Indexed each blocks use the value as the key
item.k = value;
update_item(item, value, i, flags); update_item(item, value, i, flags);
resume_effect(item.e); resume_effect(item.e);
} }
@ -274,11 +276,11 @@ function reconcile_indexed_array(array, state, anchor, render_fn, flags) {
// add items // add items
for (; i < b; i += 1) { for (; i < b; i += 1) {
value = array[i]; value = array[i];
item = paused.get(i); item = paused.get(value);
if (item === undefined || item.e.dom === null) { if (item === undefined || item.e.dom === null) {
paused.delete(i); paused.delete(value);
item = create_item(anchor, value, null, i, render_fn, flags); item = create_item(anchor, value, value, i, render_fn, flags);
} else { } else {
resume_effect(item.e); resume_effect(item.e);
move(/** @type {import('#client').Dom} */ (item.e.dom), anchor); move(/** @type {import('#client').Dom} */ (item.e.dom), anchor);

@ -311,6 +311,7 @@ function animate(element, options, counterpart, t2, callback) {
if (animation.startTime !== null && animation.currentTime !== null) { if (animation.startTime !== null && animation.currentTime !== null) {
throw e; throw e;
} }
callback?.();
}); });
} else { } else {
// Timer // Timer

@ -123,6 +123,7 @@ class Animation {
if (this.currentTime > 0 && this.currentTime < this.#duration) { if (this.currentTime > 0 && this.currentTime < this.#duration) {
this.#apply_keyframe(0); this.#apply_keyframe(0);
} }
if (this.currentTime !== null && this.startTime !== null) {
// @ts-ignore // @ts-ignore
this.currentTime = null; this.currentTime = null;
// @ts-ignore // @ts-ignore
@ -131,6 +132,7 @@ class Animation {
raf.animations.delete(this); raf.animations.delete(this);
} }
} }
}
/** /**
* @param {string} a * @param {string} a

@ -23,6 +23,7 @@ export default test({
assert.equal(spans[1].foo, 0.25); assert.equal(spans[1].foo, 0.25);
assert.equal(spans[2].foo, 0.75); assert.equal(spans[2].foo, 0.75);
debugger;
component.things = things; component.things = things;
raf.tick(225); raf.tick(225);

Loading…
Cancel
Save