feat(ssr/suspense): suspense hydration

In order to support hydration of async components, server-rendered
fragments must be explicitly marked with comment nodes.
This commit is contained in:
Evan You
2020-03-12 22:19:41 -04:00
parent b3d7d64931
commit a3cc970030
19 changed files with 385 additions and 139 deletions

View File

@@ -33,7 +33,7 @@ describe('SSR Suspense', () => {
}
})
expect(await renderToString(app)).toBe(`<div>async</div>`)
expect(await renderToString(app)).toBe(`<!--1--><div>async</div><!--0-->`)
})
test('with async component', async () => {
@@ -49,7 +49,7 @@ describe('SSR Suspense', () => {
}
})
expect(await renderToString(app)).toBe(`<div>async</div>`)
expect(await renderToString(app)).toBe(`<!--1--><div>async</div><!--0-->`)
})
test('fallback', async () => {
@@ -68,7 +68,9 @@ describe('SSR Suspense', () => {
}
})
expect(await renderToString(app)).toBe(`<div>fallback</div>`)
expect(await renderToString(app)).toBe(
`<!--1--><div>fallback</div><!--0-->`
)
expect('Uncaught error in async setup').toHaveBeenWarned()
})
})