From 16aeb9f77edaa5015bc7ffc9237149e1502e1e73 Mon Sep 17 00:00:00 2001 From: Jovi De Croock Date: Fri, 28 Jun 2024 14:56:56 +0200 Subject: [PATCH] only check is connected for dom nodes (#4409) * only check is connected for dom nodes * optimize by not accessing the dom --- src/diff/children.js | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/diff/children.js b/src/diff/children.js index 00bb6d3840..1e44c5cade 100644 --- a/src/diff/children.js +++ b/src/diff/children.js @@ -116,8 +116,12 @@ export function diffChildren( childVNode._flags & INSERT_VNODE || oldVNode._children === childVNode._children ) { - // @ts-expect-error olDom should be present on a DOM node - if (oldDom && !parentDom.contains(oldDom)) { + if ( + oldDom && + typeof childVNode.type == 'string' && + // @ts-expect-error olDom should be present on a DOM node + !parentDom.contains(oldDom) + ) { oldDom = getDomSibling(oldVNode); } oldDom = insert(childVNode, oldDom, parentDom);