From 8df212f76be241a47f5839f2b48a0ee92d16be51 Mon Sep 17 00:00:00 2001 From: Martin Kirilov Date: Thu, 10 Oct 2024 21:37:13 +0300 Subject: [PATCH] fix(runtime-dom): fix getContainerType --- packages/runtime-core/src/hydration.ts | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/packages/runtime-core/src/hydration.ts b/packages/runtime-core/src/hydration.ts index 82972e17174..b989713e367 100644 --- a/packages/runtime-core/src/hydration.ts +++ b/packages/runtime-core/src/hydration.ts @@ -71,8 +71,9 @@ const isMathMLContainer = (container: Element) => container.namespaceURI!.includes('MathML') const getContainerType = ( - container: Element | ShadowRoot, + container: Element | ShadowRoot | null, ): 'svg' | 'mathml' | undefined => { + if (null === container) return undefined if (container.nodeType !== DOMNodeTypes.ELEMENT) return undefined if (isSVGContainer(container as Element)) return 'svg' if (isMathMLContainer(container as Element)) return 'mathml' @@ -342,7 +343,7 @@ export function createHydrationFunctions( vnode, parentComponent, parentSuspense, - getContainerType(parentNode(node)!), + getContainerType(parentNode(node)), slotScopeIds, optimized, rendererInternals,