argh so close

pull/3046/head
Richard Harris 6 years ago
parent 42c2ce1065
commit 74d5e72f18

@ -424,7 +424,7 @@ export default class InlineComponentWrapper extends Wrapper {
@group_outros(); @group_outros();
const old_component = ${name}; const old_component = ${name};
@transition_out(old_component.$$.fragment, 1, 1, () => { @transition_out(old_component.$$.fragment, 1, 1, () => {
@destroy(old_component); @destroy_component(old_component);
}); });
@check_outros(); @check_outros();
} }
@ -457,10 +457,10 @@ export default class InlineComponentWrapper extends Wrapper {
} }
block.builders.outro.add_line( block.builders.outro.add_line(
`if (${name}) @transition_out(${name}.$$.fragment, #local);` `if (${name}) @transition_out(${name}.$$.fragment, 0, #local);`
); );
block.builders.destroy.add_line(`if (${name}) ${name}.$destroy(${parent_node ? '' : 'detaching'});`); block.builders.destroy.add_line(`if (${name}) @destroy_component(${name}, ${parent_node ? '' : 'detaching'});`);
} else { } else {
const expression = this.node.name === 'svelte:self' const expression = this.node.name === 'svelte:self'
? '__svelte:self__' // TODO conflict-proof this ? '__svelte:self__' // TODO conflict-proof this
@ -500,7 +500,7 @@ export default class InlineComponentWrapper extends Wrapper {
} }
block.builders.destroy.add_block(deindent` block.builders.destroy.add_block(deindent`
${name}.$destroy(${parent_node ? '' : 'detaching'}); @destroy_component(${name}, ${parent_node ? '' : 'detaching'});
`); `);
block.builders.outro.add_line( block.builders.outro.add_line(

@ -146,7 +146,7 @@ export default class SlotWrapper extends Wrapper {
); );
block.builders.outro.add_line( block.builders.outro.add_line(
`@transition_out(${slot}, #local);` `@transition_out(${slot}, 0, #local);`
); );
let update_conditions = [...this.dependencies].map(name => `changed.${name}`).join(' || '); let update_conditions = [...this.dependencies].map(name => `changed.${name}`).join(' || ');

@ -50,10 +50,12 @@ export function mount_component(component, target, anchor) {
after_render.forEach(add_render_callback); after_render.forEach(add_render_callback);
} }
export function destroy(component) { export function destroy_component(component, detaching) {
if (component.$$) { if (component.$$) {
run_all(component.$$.on_destroy); run_all(component.$$.on_destroy);
if (detaching) component.$$.fragment.d(1);
// TODO null out other refs, including component.$$ (but need to // TODO null out other refs, including component.$$ (but need to
// preserve final state?) // preserve final state?)
component.$$.on_destroy = component.$$.fragment = null; component.$$.on_destroy = component.$$.fragment = null;
@ -153,9 +155,7 @@ if (typeof HTMLElement !== 'undefined') {
} }
$destroy() { $destroy() {
const { fragment } = this.$$; destroy_component(this, 1);
destroy(this);
fragment.d(1);
this.$destroy = noop; this.$destroy = noop;
} }
@ -180,9 +180,7 @@ export class SvelteComponent {
$$: T$$; $$: T$$;
$destroy() { $destroy() {
const { fragment } = this.$$; destroy_component(this, 1);
destroy(this);
fragment.d(1);
this.$destroy = noop; this.$destroy = noop;
} }

@ -53,7 +53,7 @@ export function transition_out(block, detaching: 0 | 1, local: 0 | 1, callback)
outroing.add(block); outroing.add(block);
outros.callbacks.push(() => { outros.callbacks.push(() => {
outroing.delete(block); outroing.delete(block);
if (local) block.d(detaching); if (detaching) block.d(detaching);
if (callback) callback(); if (callback) callback();
}); });

@ -1,6 +1,7 @@
/* generated by Svelte vX.Y.Z */ /* generated by Svelte vX.Y.Z */
import { import {
SvelteComponent, SvelteComponent,
destroy_component,
init, init,
mount_component, mount_component,
noop, noop,
@ -39,7 +40,7 @@ function create_fragment(ctx) {
}, },
d(detaching) { d(detaching) {
nested.$destroy(detaching); destroy_component(nested, detaching);
} }
}; };
} }

@ -1,6 +1,7 @@
/* generated by Svelte vX.Y.Z */ /* generated by Svelte vX.Y.Z */
import { import {
SvelteComponent, SvelteComponent,
destroy_component,
init, init,
mount_component, mount_component,
noop, noop,
@ -39,7 +40,7 @@ function create_fragment(ctx) {
}, },
d(detaching) { d(detaching) {
nested.$destroy(detaching); destroy_component(nested, detaching);
} }
}; };
} }

@ -1,6 +1,7 @@
/* generated by Svelte vX.Y.Z */ /* generated by Svelte vX.Y.Z */
import { import {
SvelteComponent, SvelteComponent,
destroy_component,
init, init,
mount_component, mount_component,
noop, noop,
@ -39,7 +40,7 @@ function create_fragment(ctx) {
}, },
d(detaching) { d(detaching) {
nested.$destroy(detaching); destroy_component(nested, detaching);
} }
}; };
} }

@ -1,6 +1,7 @@
/* generated by Svelte vX.Y.Z */ /* generated by Svelte vX.Y.Z */
import { import {
SvelteComponent, SvelteComponent,
destroy_component,
init, init,
mount_component, mount_component,
noop, noop,
@ -39,7 +40,7 @@ function create_fragment(ctx) {
}, },
d(detaching) { d(detaching) {
nested.$destroy(detaching); destroy_component(nested, detaching);
} }
}; };
} }

@ -53,7 +53,7 @@ function create_fragment(ctx) {
i: noop, i: noop,
o: noop, o: noop,
d: function destroy_1(detaching) { d: function destroy(detaching) {
if (detaching) { if (detaching) {
detach(h1); detach(h1);
detach(t3); detach(t3);

@ -59,7 +59,7 @@ function create_each_block(ctx) {
} }
}, },
d: function destroy_1(detaching) { d: function destroy(detaching) {
if (detaching) { if (detaching) {
detach(span); detach(span);
detach(t1); detach(t1);
@ -137,7 +137,7 @@ function create_fragment(ctx) {
i: noop, i: noop,
o: noop, o: noop,
d: function destroy_1(detaching) { d: function destroy(detaching) {
destroy_each(each_blocks, detaching); destroy_each(each_blocks, detaching);
if (detaching) { if (detaching) {

@ -59,7 +59,7 @@ function create_each_block(ctx) {
} }
}, },
d: function destroy_1(detaching) { d: function destroy(detaching) {
if (detaching) { if (detaching) {
detach(span); detach(span);
detach(t1); detach(t1);
@ -137,7 +137,7 @@ function create_fragment(ctx) {
i: noop, i: noop,
o: noop, o: noop,
d: function destroy_1(detaching) { d: function destroy(detaching) {
destroy_each(each_blocks, detaching); destroy_each(each_blocks, detaching);
if (detaching) { if (detaching) {

@ -52,7 +52,7 @@ function create_fragment(ctx) {
i: noop, i: noop,
o: noop, o: noop,
d: function destroy_1(detaching) { d: function destroy(detaching) {
if (detaching) { if (detaching) {
detach(p); detach(p);
} }

@ -1,6 +1,7 @@
/* generated by Svelte vX.Y.Z */ /* generated by Svelte vX.Y.Z */
import { import {
SvelteComponent, SvelteComponent,
destroy_component,
init, init,
mount_component, mount_component,
noop, noop,
@ -40,7 +41,7 @@ function create_fragment(ctx) {
}, },
d(detaching) { d(detaching) {
lazyload.$destroy(detaching); destroy_component(lazyload, detaching);
} }
}; };
} }

@ -1,6 +1,7 @@
/* generated by Svelte vX.Y.Z */ /* generated by Svelte vX.Y.Z */
import { import {
SvelteComponent, SvelteComponent,
destroy_component,
detach, detach,
init, init,
insert, insert,
@ -52,13 +53,13 @@ function create_fragment(ctx) {
}, },
d(detaching) { d(detaching) {
imported.$destroy(detaching); destroy_component(imported, detaching);
if (detaching) { if (detaching) {
detach(t); detach(t);
} }
nonimported.$destroy(detaching); destroy_component(nonimported, detaching);
} }
}; };
} }

Loading…
Cancel
Save