Skip to content

Commit

Permalink
fix(runtime): append newChild if parent node doesn't match with patch…
Browse files Browse the repository at this point in the history
…ed node
  • Loading branch information
itsjustaplant committed Feb 5, 2025
1 parent bc8cc65 commit 19db966
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/runtime/dom-extras.ts
Original file line number Diff line number Diff line change
Expand Up @@ -299,6 +299,11 @@ const patchInsertBefore = (HostElementPrototype: HTMLElement) => {
});
if (found) return newChild;
}
// If currentChild's parent is not the same node with the patched node, append newChild to patched node
const parentNode = (currentChild as d.PatchedSlotNode)?.__parentNode;
if (parentNode && !this.isSameNode(parentNode)) {
return this.appendChild(newChild);
}
return (this as d.RenderNode).__insertBefore(newChild, currentChild);
};
};
Expand Down

0 comments on commit 19db966

Please sign in to comment.