mount yield blocks immediately, if yield has a parent node (fixes #561)

pull/563/head
Rich-Harris 8 years ago
parent b55797666a
commit dd2e5e8b2b

@ -1,9 +1,11 @@
export default function visitYieldTag ( generator, block, state ) {
block.builders.mount.addLine(
`${block.component}._yield && ${block.component}._yield.mount( ${state.parentNode || block.target}, null );`
const parentNode = state.parentNode || block.target;
( state.parentNode ? block.builders.create : block.builders.mount ).addLine(
`if ( ${block.component}._yield ) ${block.component}._yield.mount( ${parentNode}, null );`
);
block.builders.destroy.addLine(
`${block.component}._yield && ${block.component}._yield.destroy( detach );`
`if ( ${block.component}._yield ) ${block.component}._yield.destroy( detach );`
);
}
Loading…
Cancel
Save