fix(ssr): hydration for transition wrapper components with empty slot content (#5995)

fix #5991
This commit is contained in:
小刘(liulinboyi)
2022-06-06 16:24:40 +08:00
committed by GitHub
parent 0cf9ae62be
commit eb22a62798
4 changed files with 43 additions and 6 deletions

View File

@@ -123,7 +123,7 @@ describe('ssr: <slot>', () => {
"const { ssrRenderSlotInner: _ssrRenderSlotInner } = require(\\"vue/server-renderer\\")
return function ssrRender(_ctx, _push, _parent, _attrs) {
_ssrRenderSlotInner(_ctx.$slots, \\"default\\", {}, null, _push, _parent)
_ssrRenderSlotInner(_ctx.$slots, \\"default\\", {}, null, _push, _parent, null, true)
}"
`)
})

View File

@@ -50,6 +50,10 @@ export const ssrTransformSlotOutlet: NodeTransform = (node, context) => {
parent.children.filter(c => c.type === NodeTypes.ELEMENT).length === 1
) {
method = SSR_RENDER_SLOT_INNER
if (!(context.scopeId && context.slotted !== false)) {
args.push('null')
}
args.push('true')
}
node.ssrCodegenNode = createCallExpression(context.helper(method), args)