fix: more try finally

fix-interleaving
paoloricciuti 5 days ago
parent 90660afc76
commit 34e0a84be3

@ -431,9 +431,12 @@ export class Boundary {
if (this.#offscreen_fragment) { if (this.#offscreen_fragment) {
var pop_renderer = push_renderer(this.#effect.r, this.#effect.pr); var pop_renderer = push_renderer(this.#effect.r, this.#effect.pr);
insert_before(this.#anchor, this.#offscreen_fragment); try {
this.#offscreen_fragment = null; insert_before(this.#anchor, this.#offscreen_fragment);
pop_renderer?.(); this.#offscreen_fragment = null;
} finally {
pop_renderer?.();
}
} }
} }
} }

@ -523,59 +523,61 @@ export function destroy_effect(effect, remove_dom = true) {
var pop_renderer = push_renderer(effect.r, effect.pr); var pop_renderer = push_renderer(effect.r, effect.pr);
if ( try {
(remove_dom || (effect.f & HEAD_EFFECT) !== 0) && if (
effect.nodes !== null && (remove_dom || (effect.f & HEAD_EFFECT) !== 0) &&
effect.nodes.end !== null effect.nodes !== null &&
) { effect.nodes.end !== null
remove_effect_nodes(effect); ) {
removed = true; remove_effect_nodes(effect);
} removed = true;
}
effect.f |= DESTROYING; effect.f |= DESTROYING;
destroy_effect_children(effect, remove_dom && !removed); destroy_effect_children(effect, remove_dom && !removed);
remove_reactions(effect, 0); remove_reactions(effect, 0);
var transitions = effect.nodes && effect.nodes.t; var transitions = effect.nodes && effect.nodes.t;
if (transitions !== null) { if (transitions !== null) {
for (const transition of transitions) { for (const transition of transitions) {
transition.stop(); transition.stop();
}
} }
}
execute_effect_teardown(effect); execute_effect_teardown(effect);
effect.f ^= DESTROYING; effect.f ^= DESTROYING;
effect.f |= DESTROYED; effect.f |= DESTROYED;
var parent = effect.parent; var parent = effect.parent;
// If the parent doesn't have any children, then skip this work altogether // If the parent doesn't have any children, then skip this work altogether
if (parent !== null && parent.first !== null) { if (parent !== null && parent.first !== null) {
unlink_effect(effect); unlink_effect(effect);
} }
if (DEV) { if (DEV) {
effect.component_function = null; effect.component_function = null;
} }
// `first` and `child` are nulled out in destroy_effect_children // `first` and `child` are nulled out in destroy_effect_children
// we don't null out `parent` so that error propagation can work correctly // we don't null out `parent` so that error propagation can work correctly
effect.next = effect.next =
effect.prev = effect.prev =
effect.teardown = effect.teardown =
effect.ctx = effect.ctx =
effect.deps = effect.deps =
effect.fn = effect.fn =
effect.nodes = effect.nodes =
effect.ac = effect.ac =
effect.b = effect.b =
effect.r = effect.r =
effect.pr = effect.pr =
null; null;
} finally {
pop_renderer?.(); pop_renderer?.();
}
} }
/** /**

Loading…
Cancel
Save