@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.
package/dist/ichigo.cjs CHANGED
@@ -10136,9 +10136,9 @@
10136
10136
  */
10137
10137
  #fragmentRange;
10138
10138
  /**
10139
- * Set by {@link destroy}. A destroyed clone stays in its parent's child
10140
- * list (v-if / v-for render new clones under the same parent), so walks
10141
- * over the children must skip it.
10139
+ * Set by {@link destroy}. A destroyed node also leaves its parent's child
10140
+ * list, but a walk that took its copy of the list before the node was
10141
+ * destroyed may still reach it, and must skip it.
10142
10142
  */
10143
10143
  #destroyed = false;
10144
10144
  /**
@@ -10308,7 +10308,8 @@
10308
10308
  // walk runs once the subtree is in the document, which the outlet
10309
10309
  // cannot know when it renders inside a detached v-if / v-for clone.
10310
10310
  this.#directiveManager?.directives?.forEach(d => d.expandComponents?.());
10311
- this.#childVNodes?.forEach(child => child.expandComponents());
10311
+ // A copy: expanding can render and destroy clones under this node.
10312
+ this.#childVNodes?.slice().forEach(child => child.expandComponents());
10312
10313
  }
10313
10314
  /**
10314
10315
  * The application instance associated with this virtual node.
@@ -10620,8 +10621,9 @@
10620
10621
  updater.applyToDOM();
10621
10622
  }
10622
10623
  }
10623
- // Recursively update child virtual nodes
10624
- this.#childVNodes?.forEach(childVNode => {
10624
+ // Recursively update child virtual nodes. A copy: an update can
10625
+ // destroy a v-if / v-for clone, which removes it from this list.
10626
+ this.#childVNodes?.slice().forEach(childVNode => {
10625
10627
  childVNode.forceUpdate();
10626
10628
  });
10627
10629
  // If no directive requires template preservation, call onUpdated for directives that do not templatize
@@ -10633,7 +10635,7 @@
10633
10635
  }
10634
10636
  else if (this.#nodeType === Node.DOCUMENT_FRAGMENT_NODE) {
10635
10637
  // For document fragments, recursively force update child VNodes
10636
- this.#childVNodes?.forEach(childVNode => {
10638
+ this.#childVNodes?.slice().forEach(childVNode => {
10637
10639
  childVNode.forceUpdate();
10638
10640
  });
10639
10641
  }
@@ -10715,6 +10717,7 @@
10715
10717
  * 4. Unregister dependencies
10716
10718
  * 5. Clean up directive manager
10717
10719
  * 6. Call onUnmounted lifecycle hooks
10720
+ * 7. Leave the parent's child list
10718
10721
  */
10719
10722
  destroy() {
10720
10723
  this.#destroyed = true;
@@ -10741,9 +10744,9 @@
10741
10744
  }
10742
10745
  this.#userData.clear();
10743
10746
  }
10744
- // Recursively destroy child nodes
10747
+ // Recursively destroy child nodes (a copy: each one leaves this list)
10745
10748
  if (this.#childVNodes) {
10746
- for (const childVNode of this.#childVNodes) {
10749
+ for (const childVNode of this.#childVNodes.slice()) {
10747
10750
  try {
10748
10751
  childVNode.destroy();
10749
10752
  }
@@ -10771,6 +10774,15 @@
10771
10774
  d.onUnmounted?.();
10772
10775
  });
10773
10776
  }
10777
+ // Leave the parent's child list. v-if and v-for render every new clone
10778
+ // under the same parent VNode, so a destroyed clone left in the list
10779
+ // would keep its whole subtree — VNodes, DOM nodes, bindings — alive
10780
+ // for as long as the parent, growing with each toggle or row change.
10781
+ const siblings = this.#parentVNode ? this.#parentVNode.#childVNodes : undefined;
10782
+ const index = siblings ? siblings.indexOf(this) : -1;
10783
+ if (index !== -1) {
10784
+ siblings.splice(index, 1);
10785
+ }
10774
10786
  }
10775
10787
  }
10776
10788