]> git.ipfire.org Git - thirdparty/vuejs/core.git/commitdiff
fix(ssr): fix hydration error when teleport is used as component root
authorEvan You <yyx990803@gmail.com>
Wed, 18 May 2022 04:18:12 +0000 (12:18 +0800)
committerEvan You <yyx990803@gmail.com>
Wed, 18 May 2022 04:18:12 +0000 (12:18 +0800)
fix #4293

packages/runtime-core/src/hydration.ts

index 3d86f0f2494b66be5664fbbe19fff484de5e544b..fcc22897f5c4737e7910961157ec9ef71ac195c9 100644 (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