fix(ssr): fix hydration error for slot outlet inside transition

fix #3989
This commit is contained in:
Evan You
2022-05-12 15:06:32 +08:00
parent da49c863a2
commit 9309b044bd
6 changed files with 67 additions and 14 deletions

View File

@@ -21,6 +21,27 @@ export function ssrRenderSlot(
) {
// template-compiled slots are always rendered as fragments
push(`<!--[-->`)
ssrRenderSlotInner(
slots,
slotName,
slotProps,
fallbackRenderFn,
push,
parentComponent,
slotScopeId
)
push(`<!--]-->`)
}
export function ssrRenderSlotInner(
slots: Slots | SSRSlots,
slotName: string,
slotProps: Props,
fallbackRenderFn: (() => void) | null,
push: PushFn,
parentComponent: ComponentInternalInstance,
slotScopeId?: string
) {
const slotFn = slots[slotName]
if (slotFn) {
const slotBuffer: SSRBufferItem[] = []
@@ -59,7 +80,6 @@ export function ssrRenderSlot(
} else if (fallbackRenderFn) {
fallbackRenderFn()
}
push(`<!--]-->`)
}
const commentRE = /^<!--.*-->$/

View File

@@ -18,7 +18,7 @@ export {
// internal runtime helpers
export { renderVNode as ssrRenderVNode } from './render'
export { ssrRenderComponent } from './helpers/ssrRenderComponent'
export { ssrRenderSlot } from './helpers/ssrRenderSlot'
export { ssrRenderSlot, ssrRenderSlotInner } from './helpers/ssrRenderSlot'
export { ssrRenderTeleport } from './helpers/ssrRenderTeleport'
export {
ssrRenderClass,