Skip to content

Commit dd2e5e8

Browse files
committed
mount yield blocks immediately, if yield has a parent node (fixes #561)
1 parent b557976 commit dd2e5e8

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed
+5-3
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,11 @@
11
export default function visitYieldTag ( generator, block, state ) {
2-
block.builders.mount.addLine(
3-
`${block.component}._yield && ${block.component}._yield.mount( ${state.parentNode || block.target}, null );`
2+
const parentNode = state.parentNode || block.target;
3+
4+
( state.parentNode ? block.builders.create : block.builders.mount ).addLine(
5+
`if ( ${block.component}._yield ) ${block.component}._yield.mount( ${parentNode}, null );`
46
);
57

68
block.builders.destroy.addLine(
7-
`${block.component}._yield && ${block.component}._yield.destroy( detach );`
9+
`if ( ${block.component}._yield ) ${block.component}._yield.destroy( detach );`
810
);
911
}

0 commit comments

Comments
 (0)