@lwc/engine-core 2.31.5 → 2.31.7

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.
@@ -5569,22 +5569,33 @@ function recursivelyDisconnectChildren(vnodes) {
5569
5569
  // into snabbdom. Especially useful when the reset is a consequence of an error, in which case the
5570
5570
  // children VNodes might not be representing the current state of the DOM.
5571
5571
  function resetComponentRoot(vm) {
5572
+ recursivelyRemoveChildren(vm.children, vm);
5573
+ vm.children = EmptyArray;
5574
+ runChildNodesDisconnectedCallback(vm);
5575
+ vm.velements = EmptyArray;
5576
+ }
5577
+ // Helper function to remove all children of the root node.
5578
+ // If the set of children includes VFragment nodes, we need to remove the children of those nodes too.
5579
+ // Since VFragments can contain other VFragments, we need to traverse the entire of tree of VFragments.
5580
+ // If the set contains no VFragment nodes, no traversal is needed.
5581
+ function recursivelyRemoveChildren(vnodes, vm) {
5572
5582
  const {
5573
- children,
5574
5583
  renderRoot,
5575
5584
  renderer: {
5576
5585
  remove
5577
5586
  }
5578
5587
  } = vm;
5579
- for (let i = 0, len = children.length; i < len; i++) {
5580
- const child = children[i];
5581
- if (!shared.isNull(child) && !shared.isUndefined(child.elm)) {
5582
- remove(child.elm, renderRoot);
5588
+ for (let i = 0, len = vnodes.length; i < len; i += 1) {
5589
+ const vnode = vnodes[i];
5590
+ if (!shared.isNull(vnode)) {
5591
+ // VFragments are special; their .elm property does not point to the root element since they have no single root.
5592
+ if (isVFragment(vnode)) {
5593
+ recursivelyRemoveChildren(vnode.children, vm);
5594
+ } else if (!shared.isUndefined(vnode.elm)) {
5595
+ remove(vnode.elm, renderRoot);
5596
+ }
5583
5597
  }
5584
5598
  }
5585
- vm.children = EmptyArray;
5586
- runChildNodesDisconnectedCallback(vm);
5587
- vm.velements = EmptyArray;
5588
5599
  }
5589
5600
  function scheduleRehydration(vm) {
5590
5601
  if (!process.env.IS_BROWSER || shared.isTrue(vm.isScheduled)) {
@@ -6570,4 +6581,4 @@ exports.swapTemplate = swapTemplate;
6570
6581
  exports.track = track;
6571
6582
  exports.unwrap = unwrap;
6572
6583
  exports.wire = wire;
6573
- /* version: 2.31.5 */
6584
+ /* version: 2.31.7 */
@@ -5568,22 +5568,33 @@ function recursivelyDisconnectChildren(vnodes) {
5568
5568
  // into snabbdom. Especially useful when the reset is a consequence of an error, in which case the
5569
5569
  // children VNodes might not be representing the current state of the DOM.
5570
5570
  function resetComponentRoot(vm) {
5571
+ recursivelyRemoveChildren(vm.children, vm);
5572
+ vm.children = EmptyArray;
5573
+ runChildNodesDisconnectedCallback(vm);
5574
+ vm.velements = EmptyArray;
5575
+ }
5576
+ // Helper function to remove all children of the root node.
5577
+ // If the set of children includes VFragment nodes, we need to remove the children of those nodes too.
5578
+ // Since VFragments can contain other VFragments, we need to traverse the entire of tree of VFragments.
5579
+ // If the set contains no VFragment nodes, no traversal is needed.
5580
+ function recursivelyRemoveChildren(vnodes, vm) {
5571
5581
  const {
5572
- children,
5573
5582
  renderRoot,
5574
5583
  renderer: {
5575
5584
  remove
5576
5585
  }
5577
5586
  } = vm;
5578
- for (let i = 0, len = children.length; i < len; i++) {
5579
- const child = children[i];
5580
- if (!isNull(child) && !isUndefined$1(child.elm)) {
5581
- remove(child.elm, renderRoot);
5587
+ for (let i = 0, len = vnodes.length; i < len; i += 1) {
5588
+ const vnode = vnodes[i];
5589
+ if (!isNull(vnode)) {
5590
+ // VFragments are special; their .elm property does not point to the root element since they have no single root.
5591
+ if (isVFragment(vnode)) {
5592
+ recursivelyRemoveChildren(vnode.children, vm);
5593
+ } else if (!isUndefined$1(vnode.elm)) {
5594
+ remove(vnode.elm, renderRoot);
5595
+ }
5582
5596
  }
5583
5597
  }
5584
- vm.children = EmptyArray;
5585
- runChildNodesDisconnectedCallback(vm);
5586
- vm.velements = EmptyArray;
5587
5598
  }
5588
5599
  function scheduleRehydration(vm) {
5589
5600
  if (!process.env.IS_BROWSER || isTrue(vm.isScheduled)) {
@@ -6533,4 +6544,4 @@ function getComponentConstructor(elm) {
6533
6544
  }
6534
6545
 
6535
6546
  export { LightningElement, profilerControl as __unstable__ProfilerControl, api$1 as api, connectRootElement, createContextProvider, createVM, disconnectRootElement, freezeTemplate, getAssociatedVMIfPresent, getComponentConstructor, getComponentDef, getComponentHtmlPrototype, hydrateRoot, isComponentConstructor, parseFragment, parseSVGFragment, readonly, register, registerComponent, registerDecorators, registerTemplate, sanitizeAttribute, setHooks, swapComponent, swapStyle, swapTemplate, track, unwrap, wire };
6536
- /* version: 2.31.5 */
6547
+ /* version: 2.31.7 */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lwc/engine-core",
3
- "version": "2.31.5",
3
+ "version": "2.31.7",
4
4
  "description": "Core LWC engine APIs.",
5
5
  "homepage": "https://lwc.dev/",
6
6
  "repository": {
@@ -24,8 +24,8 @@
24
24
  "types/"
25
25
  ],
26
26
  "dependencies": {
27
- "@lwc/features": "2.31.5",
28
- "@lwc/shared": "2.31.5"
27
+ "@lwc/features": "2.31.7",
28
+ "@lwc/shared": "2.31.7"
29
29
  },
30
30
  "devDependencies": {
31
31
  "observable-membrane": "2.0.0"