@mintjamsinc/ichigojs 0.1.82 → 0.1.83

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.
@@ -10130,9 +10130,9 @@ class VNode {
10130
10130
  */
10131
10131
  #fragmentRange;
10132
10132
  /**
10133
- * Set by {@link destroy}. A destroyed clone stays in its parent's child
10134
- * list (v-if / v-for render new clones under the same parent), so walks
10135
- * over the children must skip it.
10133
+ * Set by {@link destroy}. A destroyed node also leaves its parent's child
10134
+ * list, but a walk that took its copy of the list before the node was
10135
+ * destroyed may still reach it, and must skip it.
10136
10136
  */
10137
10137
  #destroyed = false;
10138
10138
  /**
@@ -10302,7 +10302,8 @@ class VNode {
10302
10302
  // walk runs once the subtree is in the document, which the outlet
10303
10303
  // cannot know when it renders inside a detached v-if / v-for clone.
10304
10304
  this.#directiveManager?.directives?.forEach(d => d.expandComponents?.());
10305
- this.#childVNodes?.forEach(child => child.expandComponents());
10305
+ // A copy: expanding can render and destroy clones under this node.
10306
+ this.#childVNodes?.slice().forEach(child => child.expandComponents());
10306
10307
  }
10307
10308
  /**
10308
10309
  * The application instance associated with this virtual node.
@@ -10614,8 +10615,9 @@ class VNode {
10614
10615
  updater.applyToDOM();
10615
10616
  }
10616
10617
  }
10617
- // Recursively update child virtual nodes
10618
- this.#childVNodes?.forEach(childVNode => {
10618
+ // Recursively update child virtual nodes. A copy: an update can
10619
+ // destroy a v-if / v-for clone, which removes it from this list.
10620
+ this.#childVNodes?.slice().forEach(childVNode => {
10619
10621
  childVNode.forceUpdate();
10620
10622
  });
10621
10623
  // If no directive requires template preservation, call onUpdated for directives that do not templatize
@@ -10627,7 +10629,7 @@ class VNode {
10627
10629
  }
10628
10630
  else if (this.#nodeType === Node.DOCUMENT_FRAGMENT_NODE) {
10629
10631
  // For document fragments, recursively force update child VNodes
10630
- this.#childVNodes?.forEach(childVNode => {
10632
+ this.#childVNodes?.slice().forEach(childVNode => {
10631
10633
  childVNode.forceUpdate();
10632
10634
  });
10633
10635
  }
@@ -10709,6 +10711,7 @@ class VNode {
10709
10711
  * 4. Unregister dependencies
10710
10712
  * 5. Clean up directive manager
10711
10713
  * 6. Call onUnmounted lifecycle hooks
10714
+ * 7. Leave the parent's child list
10712
10715
  */
10713
10716
  destroy() {
10714
10717
  this.#destroyed = true;
@@ -10735,9 +10738,9 @@ class VNode {
10735
10738
  }
10736
10739
  this.#userData.clear();
10737
10740
  }
10738
- // Recursively destroy child nodes
10741
+ // Recursively destroy child nodes (a copy: each one leaves this list)
10739
10742
  if (this.#childVNodes) {
10740
- for (const childVNode of this.#childVNodes) {
10743
+ for (const childVNode of this.#childVNodes.slice()) {
10741
10744
  try {
10742
10745
  childVNode.destroy();
10743
10746
  }
@@ -10765,6 +10768,15 @@ class VNode {
10765
10768
  d.onUnmounted?.();
10766
10769
  });
10767
10770
  }
10771
+ // Leave the parent's child list. v-if and v-for render every new clone
10772
+ // under the same parent VNode, so a destroyed clone left in the list
10773
+ // would keep its whole subtree — VNodes, DOM nodes, bindings — alive
10774
+ // for as long as the parent, growing with each toggle or row change.
10775
+ const siblings = this.#parentVNode ? this.#parentVNode.#childVNodes : undefined;
10776
+ const index = siblings ? siblings.indexOf(this) : -1;
10777
+ if (index !== -1) {
10778
+ siblings.splice(index, 1);
10779
+ }
10768
10780
  }
10769
10781
  }
10770
10782