pull/1864/head
Rich Harris 7 years ago
parent d5d854c51a
commit fba0f58226

@ -101,7 +101,13 @@ export class $$Component {
// we schedule onMount callbacks before afterRender callbacks
after_render(() => {
const onDestroy = this.$$onMount.map(run).filter(is_function);
if (this.$$onDestroy) {
this.$$onDestroy.push(...onDestroy);
} else {
// Edge case — component was destroyed immediately,
// most likely as a result of a binding initialising
run_all(onDestroy);
}
this.$$onMount = [];
});

@ -15,7 +15,7 @@
<input type='number' bind:value={count}>
<ol>
{#each ids as object (object.id)}
{#each ids() as object (object.id)}
<Nested bind:value={idToValue[object.id]} id={object.id}>
{object.id}: value is {idToValue[object.id]}
</Nested>

@ -6,12 +6,12 @@ export default {
<p>y: bar</p>
`,
test ( assert, component, target ) {
test(assert, component, target) {
component.x = false;
assert.htmlEqual( target.innerHTML, `
assert.htmlEqual(target.innerHTML, `
<p>y: bar</p>
<p>y: bar</p>
` );
`);
}
};

Loading…
Cancel
Save