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

@@ -1,4 +1,5 @@
import { compile } from '../src'
import { ssrHelpers, SSR_RENDER_SLOT_INNER } from '../src/runtimeHelpers'
describe('ssr: <slot>', () => {
test('basic', () => {
@@ -114,4 +115,16 @@ describe('ssr: <slot>', () => {
}"
`)
})
test('inside transition', () => {
const { code } = compile(`<transition><slot/></transition>`)
expect(code).toMatch(ssrHelpers[SSR_RENDER_SLOT_INNER])
expect(code).toMatchInlineSnapshot(`
"const { ssrRenderSlotInner: _ssrRenderSlotInner } = require(\\"vue/server-renderer\\")
return function ssrRender(_ctx, _push, _parent, _attrs) {
_ssrRenderSlotInner(_ctx.$slots, \\"default\\", {}, null, _push, _parent)
}"
`)
})
})