remove ondestroy functions

pull/10948/head
Rich Harris 2 years ago
parent 0dd52ff1d2
commit 608dfa2b42

@ -1,5 +1,4 @@
import { is_promise } from '../../../common.js';
import { remove } from '../reconciler.js';
import {
current_component_context,
flushSync,
@ -62,7 +61,6 @@ export function await_block(anchor, get_input, pending_fn, then_fn, catch_fn) {
if (pending_fn) {
if (pending_effect && (pending_effect.f & INERT) === 0) {
if (pending_effect.dom) remove(pending_effect.dom);
destroy_effect(pending_effect);
}
@ -96,7 +94,6 @@ export function await_block(anchor, get_input, pending_fn, then_fn, catch_fn) {
if (then_fn) {
if (then_effect) {
if (then_effect.dom) remove(then_effect.dom);
destroy_effect(then_effect);
}
@ -104,11 +101,4 @@ export function await_block(anchor, get_input, pending_fn, then_fn, catch_fn) {
}
}
});
effect.ondestroy = () => {
// TODO this sucks, tidy it up
if (pending_effect?.dom) remove(pending_effect.dom);
if (then_effect?.dom) remove(then_effect.dom);
if (catch_effect?.dom) remove(catch_effect.dom);
};
}

@ -1,13 +1,7 @@
import { IS_ELSEIF } from '../../constants.js';
import { hydrate_nodes, hydrating, set_hydrating } from '../hydration.js';
import { remove } from '../reconciler.js';
import {
block,
branch,
destroy_effect,
pause_effect,
resume_effect
} from '../../reactivity/effects.js';
import { block, branch, pause_effect, resume_effect } from '../../reactivity/effects.js';
/**
* @param {Comment} anchor
@ -93,15 +87,4 @@ export function if_block(
if (elseif) {
effect.f |= IS_ELSEIF;
}
effect.ondestroy = () => {
// TODO why is this not automatic? this should be children of `if_effect`
if (consequent_effect) {
destroy_effect(consequent_effect);
}
if (alternate_effect) {
destroy_effect(alternate_effect);
}
};
}

Loading…
Cancel
Save