address feedback

pull/11062/head
Dominic Gannaway 8 months ago
parent bc17c6f72b
commit 09ca4c46d2

@ -75,8 +75,9 @@ 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++) {
var item = items[i];
paused.delete(item.k); paused.delete(item.k);
destroy_effect(items[i].e); destroy_effect(item.e);
} }
}); });
} }
@ -266,8 +267,6 @@ 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 index as the key
item.k = i;
update_item(item, value, i, flags); update_item(item, value, i, flags);
resume_effect(item.e); resume_effect(item.e);
} }
@ -278,12 +277,12 @@ function reconcile_indexed_array(array, state, anchor, render_fn, flags) {
value = array[i]; value = array[i];
item = paused.get(i); item = paused.get(i);
if (item === undefined || item.e.dom === null) { if (item === undefined) {
paused.delete(i); paused.delete(i);
item = create_item(anchor, value, i, i, render_fn, flags); item = create_item(anchor, value, i, i, render_fn, flags);
} else { } else {
resume_effect(item.e);
move(/** @type {import('#client').Dom} */ (item.e.dom), anchor); move(/** @type {import('#client').Dom} */ (item.e.dom), anchor);
resume_effect(item.e);
} }
b_items[i] = item; b_items[i] = item;
@ -380,12 +379,12 @@ function reconcile_tracked_array(array, state, anchor, render_fn, flags, keys) {
key = keys[start]; key = keys[start];
item = paused.get(key); item = paused.get(key);
if (item === undefined || item.e.dom === null) { if (item === undefined) {
paused.delete(key); paused.delete(key);
item = create_item(anchor, array[start], key, start, render_fn, flags); item = create_item(anchor, array[start], key, start, render_fn, flags);
} else { } else {
resume_effect(item.e);
move(/** @type {import('#client').Dom} */ (item.e.dom), anchor); move(/** @type {import('#client').Dom} */ (item.e.dom), anchor);
resume_effect(item.e);
} }
b_items[start++] = item; b_items[start++] = item;
@ -466,12 +465,12 @@ function reconcile_tracked_array(array, state, anchor, render_fn, flags, keys) {
key = keys[b]; key = keys[b];
item = paused.get(keys[b]); item = paused.get(keys[b]);
if (item === undefined || item.e.dom === null) { if (item === undefined) {
paused.delete(key); paused.delete(key);
item = create_item(anchor, array[b], key, b, render_fn, flags); item = create_item(anchor, array[b], key, b, render_fn, flags);
} else { } else {
resume_effect(item.e);
move(/** @type {import('#client').Dom} */ (item.e.dom), anchor); move(/** @type {import('#client').Dom} */ (item.e.dom), anchor);
resume_effect(item.e);
} }
} else { } else {
item = b_items[b]; item = b_items[b];

@ -311,6 +311,9 @@ 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;
} }
// If we have an aborted request and the element is detached from the DOM, then that
// means that it's likely that the animation was paused upon the DOM element being
// removed. This won't trigger the finish logic, so we need to ensure the callback is fired.
if (!element.isConnected) { if (!element.isConnected) {
callback?.(); callback?.();
} }

Loading…
Cancel
Save