From bd29648e2603aed988806f60a3480cfa13cfb22b Mon Sep 17 00:00:00 2001 From: Jovi De Croock Date: Sat, 15 Jun 2024 13:08:21 +0200 Subject: [PATCH] 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 94f2dd8baa..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 && oldDom.nodeType === 1 && !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);