From b60cff052c880b2965d06007f0ec4d0349ab47c0 Mon Sep 17 00:00:00 2001 From: Evan You Date: Wed, 18 May 2022 12:18:12 +0800 Subject: [PATCH] fix(ssr): fix hydration error when teleport is used as component root fix #4293 --- packages/runtime-core/src/hydration.ts | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/packages/runtime-core/src/hydration.ts b/packages/runtime-core/src/hydration.ts index 3d86f0f2494..fcc22897f5c 100644 --- a/packages/runtime-core/src/hydration.ts +++ b/packages/runtime-core/src/hydration.ts @@ -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