only call .update on yield fragment if it's present (#514)

pull/515/head
Conduitry 8 years ago
parent 1fd3c21194
commit 2adfa2e92e

@ -113,9 +113,11 @@ export default function visitComponent ( generator, block, state, node ) {
`var ${yieldFragment} = ${childBlock.name}( ${params}, ${block.component} );`
);
block.builders.update.addLine(
`${yieldFragment}.update( changed, ${params} );`
);
if ( childBlock.hasUpdateMethod ) {
block.builders.update.addLine(
`${yieldFragment}.update( changed, ${params} );`
);
}
componentInitProperties.push( `_yield: ${yieldFragment}`);
}
@ -183,4 +185,4 @@ export default function visitComponent ( generator, block, state, node ) {
block.builders.create.addBlock( local.create );
if ( !local.update.isEmpty() ) block.builders.update.addBlock( local.update );
}
}

@ -0,0 +1,12 @@
export default {
html: `
<b>Hello</b>
`,
test ( assert, component, target ) {
component.set( { name: 'World' } );
assert.htmlEqual( target.innerHTML, `
<b>Hello</b> World
` );
}
};

@ -0,0 +1,12 @@
<Widget>Hello</Widget> {{name}}
<script>
import Widget from './Widget.html';
export default {
components: { Widget },
data() {
return { name: '' };
}
};
</script>
Loading…
Cancel
Save