Skip to content

Commit b60cff0

Browse files
committed
fix(ssr): fix hydration error when teleport is used as component root
fix #4293
1 parent fd2aa12 commit b60cff0

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

packages/runtime-core/src/hydration.ts

+9
Original file line numberDiff line numberDiff line change
@@ -207,6 +207,15 @@ export function createHydrationFunctions(
207207
? locateClosingAsyncAnchor(node)
208208
: nextSibling(node)
209209

210+
// #4293 teleport as component root
211+
if (
212+
nextNode &&
213+
isComment(nextNode) &&
214+
nextNode.data === 'teleport end'
215+
) {
216+
nextNode = nextSibling(nextNode)
217+
}
218+
210219
// #3787
211220
// if component is async, it may get moved / unmounted before its
212221
// inner component is loaded, so we need to give it a placeholder

0 commit comments

Comments
 (0)