}"
`)
})
+
+ test('inside transition-group', () => {
+ const { code } = compile(
+ `<TransitionGroup tag="div"><slot/></TransitionGroup>`,
+ )
+ expect(code).toMatch(ssrHelpers[SSR_RENDER_SLOT_INNER])
+ expect(code).toMatchInlineSnapshot(`
+ "const { ssrRenderSlotInner: _ssrRenderSlotInner, ssrRenderAttrs: _ssrRenderAttrs } = require("vue/server-renderer")
+
+ return function ssrRender(_ctx, _push, _parent, _attrs) {
+ _push(\`<div\${_ssrRenderAttrs(_attrs)}>\`)
+ _ssrRenderSlotInner(_ctx.$slots, "default", {}, null, _push, _parent, null, true)
+ _push(\`</div>\`)
+ }"
+ `)
+ })
})
NodeTypes,
type SlotOutletNode,
TRANSITION,
+ TRANSITION_GROUP,
createCallExpression,
createFunctionExpression,
isSlotOutlet,
let method = SSR_RENDER_SLOT
- // #3989
+ // #3989, #9933
// check if this is a single slot inside a transition wrapper - since
- // transition will unwrap the slot fragment into a single vnode at runtime,
+ // transition/transition-group will unwrap the slot fragment into vnode(s) at runtime,
// we need to avoid rendering the slot as a fragment.
const parent = context.parent
+ let componentType
if (
parent &&
parent.type === NodeTypes.ELEMENT &&
parent.tagType === ElementTypes.COMPONENT &&
- resolveComponentType(parent, context, true) === TRANSITION &&
+ ((componentType = resolveComponentType(parent, context, true)) ===
+ TRANSITION ||
+ componentType === TRANSITION_GROUP) &&
parent.children.filter(c => c.type === NodeTypes.ELEMENT).length === 1
) {
method = SSR_RENDER_SLOT_INNER