igniteui-angular 21.2.8 → 21.2.10

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.
@@ -4559,11 +4559,14 @@ class IgxForOfDirective extends IgxForOfToken {
4559
4559
  const container = this.dc.instance._vcr;
4560
4560
  for (let i = start; i < end && this.igxForOf[i] !== undefined; i++) {
4561
4561
  const embView = this._embeddedViews.shift();
4562
- if (!embView.destroyed) {
4562
+ if (embView && !embView.destroyed) {
4563
4563
  this.scrollFocus(embView.rootNodes.find(node => node.nodeType === Node.ELEMENT_NODE)
4564
4564
  || embView.rootNodes[0].nextElementSibling);
4565
4565
  const view = container.detach(0);
4566
4566
  this.updateTemplateContext(embView.context, i);
4567
+ // Because in Elements the whole parent div (containing data-index) gets removed (possibly due to being disconnected). In Angular it just gets moved.
4568
+ // This ensures to update it with the new context and remove it first from DOM because of detach action before inserting it manually.
4569
+ view.detectChanges();
4567
4570
  container.insert(view);
4568
4571
  this._embeddedViews.push(embView);
4569
4572
  }
@@ -4577,11 +4580,13 @@ class IgxForOfDirective extends IgxForOfToken {
4577
4580
  const container = this.dc.instance._vcr;
4578
4581
  for (let i = prevIndex - 1; i >= this.state.startIndex && this.igxForOf[i] !== undefined; i--) {
4579
4582
  const embView = this._embeddedViews.pop();
4580
- if (!embView.destroyed) {
4583
+ if (embView && !embView.destroyed) {
4581
4584
  this.scrollFocus(embView.rootNodes.find(node => node.nodeType === Node.ELEMENT_NODE)
4582
4585
  || embView.rootNodes[0].nextElementSibling);
4586
+ // embView and view both refer to the same collections
4583
4587
  const view = container.detach(container.length - 1);
4584
4588
  this.updateTemplateContext(embView.context, i);
4589
+ view.detectChanges();
4585
4590
  container.insert(view, 0);
4586
4591
  this._embeddedViews.unshift(embView);
4587
4592
  }