Skip to content

Commit

Permalink
only check is connected for dom nodes (#4409)
Browse files Browse the repository at this point in the history
* only check is connected for dom nodes

* optimize by not accessing the dom
  • Loading branch information
JoviDeCroock authored Jun 28, 2024
1 parent 76f5d66 commit 16aeb9f
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions src/diff/children.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit 16aeb9f

Please sign in to comment.