Skip to content

Commit

Permalink
replace isConnected with parentDom.contains (#4421)
Browse files Browse the repository at this point in the history
* replace isConnected with parentDom.contains

* add contains
  • Loading branch information
JoviDeCroock authored Jun 25, 2024
1 parent 92e86e9 commit eb37677
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 1 deletion.
1 change: 1 addition & 0 deletions compat/src/portals.js
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ function Portal(props) {
nodeType: 1,
parentNode: container,
childNodes: [],
contains: () => true,
appendChild(child) {
this.childNodes.push(child);
_this._container.appendChild(child);
Expand Down
2 changes: 1 addition & 1 deletion src/diff/children.js
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ export function diffChildren(
oldVNode._children === childVNode._children
) {
// @ts-expect-error olDom should be present on a DOM node
if (oldDom && !oldDom.isConnected) {
if (oldDom && !parentDom.contains(oldDom)) {
oldDom = getDomSibling(oldVNode);
}
oldDom = insert(childVNode, oldDom, parentDom);
Expand Down

0 comments on commit eb37677

Please sign in to comment.