@@ -40,24 +40,30 @@ export const ssrTransformSlotOutlet: NodeTransform = (node, context) => {
40
40
41
41
// #3989, #9933
42
42
// check if this is a single slot inside a transition wrapper - since
43
- // transition/transition-group will unwrap the slot fragment into vnode(s) at runtime,
44
- // we need to avoid rendering the slot as a fragment.
45
- const parent = context . parent
46
- let componentType
47
- if (
48
- parent &&
49
- parent . type === NodeTypes . ELEMENT &&
50
- parent . tagType === ElementTypes . COMPONENT &&
51
- ( ( componentType = resolveComponentType ( parent , context , true ) ) ===
52
- TRANSITION ||
53
- componentType === TRANSITION_GROUP ) &&
54
- parent . children . filter ( c => c . type === NodeTypes . ELEMENT ) . length === 1
55
- ) {
56
- method = SSR_RENDER_SLOT_INNER
57
- if ( ! ( context . scopeId && context . slotted !== false ) ) {
58
- args . push ( 'null' )
43
+ // transition/transition-group will unwrap the slot fragment into vnode(s)
44
+ // at runtime, we need to avoid rendering the slot as a fragment.
45
+ let parent = context . parent !
46
+ if ( parent ) {
47
+ const children = parent . children
48
+ // #10743 <slot v-if> in <Transition>
49
+ if ( parent . type === NodeTypes . IF_BRANCH ) {
50
+ parent = context . grandParent !
51
+ }
52
+ let componentType
53
+ if (
54
+ parent . type === NodeTypes . ELEMENT &&
55
+ parent . tagType === ElementTypes . COMPONENT &&
56
+ ( ( componentType = resolveComponentType ( parent , context , true ) ) ===
57
+ TRANSITION ||
58
+ componentType === TRANSITION_GROUP ) &&
59
+ children . filter ( c => c . type === NodeTypes . ELEMENT ) . length === 1
60
+ ) {
61
+ method = SSR_RENDER_SLOT_INNER
62
+ if ( ! ( context . scopeId && context . slotted !== false ) ) {
63
+ args . push ( 'null' )
64
+ }
65
+ args . push ( 'true' )
59
66
}
60
- args . push ( 'true' )
61
67
}
62
68
63
69
node . ssrCodegenNode = createCallExpression ( context . helper ( method ) , args )
0 commit comments