@unsetsoft/ryunixjs 1.2.4-canary.14 → 1.2.4-canary.15

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.
@@ -598,7 +598,7 @@
598
598
  runEffects(fiber);
599
599
  } else if (fiber.effectTag === EFFECT_TAGS.DELETION) {
600
600
  cancelEffectsDeep(fiber);
601
- commitDeletion(fiber, domParent);
601
+ commitDeletion(fiber);
602
602
  return
603
603
  }
604
604
 
@@ -608,11 +608,13 @@
608
608
 
609
609
  const commitDeletion = (fiber, domParent) => {
610
610
  if (fiber.dom) {
611
- domParent.removeChild(fiber.dom);
611
+ if (fiber.dom.parentNode) {
612
+ fiber.dom.parentNode.removeChild(fiber.dom);
613
+ }
612
614
  } else {
613
615
  let child = fiber.child;
614
616
  while (child) {
615
- commitDeletion(child, domParent);
617
+ commitDeletion(child);
616
618
  child = child.sibling;
617
619
  }
618
620
  }
@@ -625,6 +627,7 @@
625
627
  const state = getState();
626
628
  let index = 0;
627
629
  let prevSibling;
630
+ let isFirstChild = true;
628
631
 
629
632
  // Build map of old fibers by key/index
630
633
  const oldFiberMap = new Map();
@@ -632,7 +635,7 @@
632
635
  let position = 0;
633
636
 
634
637
  while (oldFiber) {
635
- const key = oldFiber.key ?? `__index_${position}__`;
638
+ const key = oldFiber.key ?? `__index_${oldFiber.index ?? position}__`;
636
639
  oldFiberMap.set(key, oldFiber);
637
640
  oldFiber = oldFiber.sibling;
638
641
  position++;
@@ -663,6 +666,7 @@
663
666
  effectTag: EFFECT_TAGS.UPDATE,
664
667
  hooks: matchedFiber.hooks,
665
668
  key: element.key,
669
+ index,
666
670
  };
667
671
  oldFiberMap.delete(key);
668
672
  } else {
@@ -675,6 +679,7 @@
675
679
  alternate: null,
676
680
  effectTag: EFFECT_TAGS.PLACEMENT,
677
681
  key: element.key,
682
+ index,
678
683
  };
679
684
 
680
685
  // Mark matched fiber for deletion if exists
@@ -686,8 +691,9 @@
686
691
  }
687
692
 
688
693
  // Link fibers
689
- if (index === 0) {
694
+ if (isFirstChild) {
690
695
  wipFiber.child = newFiber;
696
+ isFirstChild = false;
691
697
  } else if (newFiber) {
692
698
  prevSibling.sibling = newFiber;
693
699
  }
@@ -809,14 +815,10 @@
809
815
  hook.queue.push(action);
810
816
 
811
817
  const currentState = getState();
812
- currentState.wipRoot = currentState.currentRoot ? {
818
+ currentState.wipRoot = {
813
819
  dom: currentState.currentRoot.dom,
814
820
  props: currentState.currentRoot.props,
815
821
  alternate: currentState.currentRoot,
816
- } : {
817
- dom: currentState.wipRoot ? currentState.wipRoot.dom : currentState.containerRoot,
818
- props: currentState.wipRoot ? currentState.wipRoot.props : { children: [] },
819
- alternate: null,
820
822
  };
821
823
  currentState.deletions = [];
822
824
  currentState.hookIndex = 0;