Skip to content

fix(pivot): Add igxForTrackBy for pivot horizontal layout#17291

Open
mddragnev wants to merge 1 commit into
20.1.xfrom
mdragnev/fix-17264-20.1.x
Open

fix(pivot): Add igxForTrackBy for pivot horizontal layout#17291
mddragnev wants to merge 1 commit into
20.1.xfrom
mdragnev/fix-17264-20.1.x

Conversation

@mddragnev
Copy link
Copy Markdown
Member

Closes #17264

Description

When using horizontal row layout, the igxGridFor directive bound to the grouped row dimension data was comparing items by object reference. The pivotGridHorizontalRowGrouping pipe always produces new array references via cloneArray, so after each contentSizeChange event triggered regroupTrigger to increment and the pipe to rerun, the differ considered all items changed, causing _applyChanges() to touch the DOM, which triggered the contentObserver, which fired contentSizeChange again — creating an infinite loop.

Type of Change (check all that apply):

  • Bug fix
  • New functionality
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • Refactoring (no functional changes)
  • Documentation
  • Demos
  • CI/CD
  • Tests
  • Changelog
  • Skills/Agents

Component(s) / Area(s) Affected:

How Has This Been Tested?

  • Unit tests
  • Manual testing
  • Automated e2e tests

Test Configuration:

  • Angular version:
  • Browser(s):
  • OS:

Screenshots / Recordings

Checklist:

  • All relevant tags have been applied to this PR
  • This PR includes unit tests covering all the new code (test guidelines)
  • This PR includes API docs for newly added methods/properties (api docs guidelines)
  • This PR includes feature/README.MD updates for the feature docs
  • This PR includes general feature table updates in the root README.MD
  • This PR includes CHANGELOG.MD updates for newly added functionality
  • This PR contains breaking changes
  • This PR includes ng update migrations for the breaking changes (migrations guidelines)
  • This PR includes behavioral changes and the feature specification has been updated with them
  • Accessibility (ARIA, keyboard navigation, focus management) has been verified

@mddragnev mddragnev requested a review from MayaKirova May 21, 2026 15:20
Copilot AI review requested due to automatic review settings May 21, 2026 15:20
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Fixes Pivot Grid horizontal row layout re-render loop/flickering by ensuring the grouped row-dimension virtualization (igxGridFor) can track row groups by a stable key instead of object reference (preventing full-diff DOM updates on each regroup).

Changes:

  • Add a trackHorizontalRowGroup trackBy function to provide stable identity for horizontal row groups.
  • Bind [igxForTrackBy] in the horizontal row-dimensions igxGridFor template to prevent unnecessary DOM churn.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.

File Description
projects/igniteui-angular/src/lib/grids/pivot-grid/pivot-grid.component.ts Adds a trackBy function for horizontal row grouping virtualization.
projects/igniteui-angular/src/lib/grids/pivot-grid/pivot-grid.component.html Wires the new trackBy into the horizontal row-dimensions igxGridFor.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

}
}

protected trackHorizontalRowGroup = (_index: number, rowGroup: IPivotGridRecord[]) => rowGroup[0]?.dataIndex;
Comment on lines 170 to 179
<ng-template #verticalRowDimScrollContainer role="rowgroup" igxGridFor let-rowGroup let-rowIndex="index"
[igxGridForOf]="groupedData"
[igxForScrollOrientation]="'vertical'"
[igxForScrollContainer]="verticalScroll"
[igxForContainerSize]="calcHeight"
[igxForItemSize]="renderedRowHeight"
[igxForSizePropName]="'height'"
[igxForTrackBy]="trackHorizontalRowGroup"
>
<igx-pivot-row-dimension-mrl-row [rowIndex]="rowIndex" [rowGroup]="rowGroup" [groupedData]="groupedData" [style.height.px]="renderedRowHeight * rowGroup.length"></igx-pivot-row-dimension-mrl-row>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants