fix(pivot): Add igxForTrackBy for pivot horizontal layout#17291
Open
mddragnev wants to merge 1 commit into
Open
fix(pivot): Add igxForTrackBy for pivot horizontal layout#17291mddragnev wants to merge 1 commit into
mddragnev wants to merge 1 commit into
Conversation
Contributor
There was a problem hiding this comment.
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
trackHorizontalRowGrouptrackBy function to provide stable identity for horizontal row groups. - Bind
[igxForTrackBy]in the horizontal row-dimensionsigxGridFortemplate 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> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #17264
Description
When using horizontal row layout, the
igxGridFordirective bound to the grouped row dimension data was comparing items by object reference. ThepivotGridHorizontalRowGroupingpipe always produces new array references viacloneArray, so after eachcontentSizeChangeevent triggeredregroupTriggerto increment and the pipe to rerun, the differ considered all items changed, causing_applyChanges()to touch the DOM, which triggered thecontentObserver, which firedcontentSizeChangeagain — creating an infinite loop.Type of Change (check all that apply):
Component(s) / Area(s) Affected:
How Has This Been Tested?
Test Configuration:
Screenshots / Recordings
Checklist:
feature/README.MDupdates for the feature docsREADME.MDCHANGELOG.MDupdates for newly added functionalityng updatemigrations for the breaking changes (migrations guidelines)