From 7fbf03f699199da6f91aa078fd9c44ed40023c71 Mon Sep 17 00:00:00 2001 From: Jovi De Croock Date: Fri, 5 Apr 2024 11:28:41 +0200 Subject: [PATCH] fix: check whether `oldDom` is present in the DOM (#4318) * leverage isConnected * expect ts error --- src/diff/children.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/diff/children.js b/src/diff/children.js index eba002d56d..1b4d6b55dc 100644 --- a/src/diff/children.js +++ b/src/diff/children.js @@ -116,7 +116,8 @@ export function diffChildren( childVNode._flags & INSERT_VNODE || oldVNode._children === childVNode._children ) { - if (!newDom && oldVNode._dom == oldDom) { + // @ts-expect-error olDom should be present on a DOM node + if (oldDom && !oldDom.isConnected) { oldDom = getDomSibling(oldVNode); } oldDom = insert(childVNode, oldDom, parentDom);