fix(ssr): fix hydration error when teleport is used as component root

fix #4293
This commit is contained in:
Evan You 2022-05-18 12:18:12 +08:00
parent fd2aa120a1
commit b60cff052c

View File

@ -207,6 +207,15 @@ export function createHydrationFunctions(
? locateClosingAsyncAnchor(node)
: nextSibling(node)
// #4293 teleport as component root
if (
nextNode &&
isComment(nextNode) &&
nextNode.data === 'teleport end'
) {
nextNode = nextSibling(nextNode)
}
// #3787
// if component is async, it may get moved / unmounted before its
// inner component is loaded, so we need to give it a placeholder