@unsetsoft/ryunixjs 1.2.4-canary.7 → 1.2.4-canary.8

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -560,6 +560,7 @@ const commitRoot = () => {
560
560
  commitWork(state.wipRoot.child);
561
561
  state.currentRoot = state.wipRoot;
562
562
  state.wipRoot = null;
563
+ state.deletions = []; // Clear deletions after commit
563
564
  };
564
565
 
565
566
  const commitWork = (fiber) => {
@@ -602,8 +603,13 @@ const commitWork = (fiber) => {
602
603
 
603
604
  const commitDeletion = (fiber, domParent) => {
604
605
  if (fiber.dom) {
605
- domParent.removeChild(fiber.dom);
606
- } else {
606
+ if (fiber.dom.parentNode === domParent) {
607
+ domParent.removeChild(fiber.dom);
608
+ } else if (fiber.dom.parentNode) {
609
+ // If parent is different, still remove it to be safe and clean the DOM
610
+ fiber.dom.parentNode.removeChild(fiber.dom);
611
+ }
612
+ } else if (fiber.child) {
607
613
  let child = fiber.child;
608
614
  while (child) {
609
615
  commitDeletion(child, domParent);