WIP: destroy components before their immediate parents

This feels hacky beyond belief, maybe there's a better way to know where in the `block.chunks.destroy` to put thate statement?

Should `block.chunks` get a new array, `componentDestroys` or something?
pull/4753/head
Pat Cavit 5 years ago
parent 190e339004
commit 3394b62cd7

@ -484,7 +484,7 @@ export default class InlineComponentWrapper extends Wrapper {
b`if (${name}) @transition_out(${name}.$$.fragment, #local);`
);
block.chunks.destroy.push(b`if (${name}) @destroy_component(${name}, ${parent_node ? null : 'detaching'});`);
block.chunks.destroy.splice(-1, 0, b`if (${name}) @destroy_component(${name}, ${parent_node ? null : 'detaching'});`);
} else {
const expression = this.node.name === 'svelte:self'
? component.name
@ -523,7 +523,7 @@ export default class InlineComponentWrapper extends Wrapper {
`);
}
block.chunks.destroy.push(b`
block.chunks.destroy.splice(-1, 0, b`
@destroy_component(${name}, ${parent_node ? null : 'detaching'});
`);

@ -69,8 +69,8 @@ function create_fragment(ctx) {
},
d(detaching) {
destroy_component(foo, detaching);
if (detaching) detach(t0);
destroy_component(bar, detaching);
if (detaching) detach(t0);
if (detaching) detach(t1);
if (detaching) detach(input);
dispose();

@ -48,8 +48,8 @@ function create_fragment(ctx) {
},
d(detaching) {
destroy_component(imported, detaching);
if (detaching) detach(t);
destroy_component(nonimported, detaching);
if (detaching) detach(t);
}
};
}

Loading…
Cancel
Save