From: Evan You Date: Wed, 18 May 2022 04:18:12 +0000 (+0800) Subject: fix(ssr): fix hydration error when teleport is used as component root X-Git-Tag: v3.2.34~15 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=b60cff052c880b2965d06007f0ec4d0349ab47c0;p=thirdparty%2Fvuejs%2Fcore.git fix(ssr): fix hydration error when teleport is used as component root fix #4293 --- diff --git a/packages/runtime-core/src/hydration.ts b/packages/runtime-core/src/hydration.ts index 3d86f0f249..fcc22897f5 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