Skip to content

Commit 61a2f7b

Browse files
MKirovaMKirova
authored andcommitted
Prevent processing same record by ref multiple times.
1 parent a3b7d18 commit 61a2f7b

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

projects/igniteui-angular/src/lib/data-operations/pivot-strategy.ts

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -114,17 +114,20 @@ export class PivotColumnDimensionsStrategy implements IPivotDimensionStrategy {
114114
and use when creating the columns in pivot grid instead of recreating it */
115115
const keys = Object.keys(hierarchy);
116116
//remove all record keys from final data since we don't need them anymore.
117+
hierarchy.processed = true;
117118
keys.forEach(k => {
118119
if (k.indexOf(pivotKeys.records) !== -1) {
119-
if (hierarchy[k] && k !== pivotKeys.records) {
120-
this.processHierarchy(hierarchy[k], columns, values, pivotKeys);
120+
if (hierarchy[k] && hierarchy[k].length > 0 && k !== pivotKeys.records) {
121+
const unprocessed = hierarchy[k].filter(r => !r.processed);
122+
this.processHierarchy(unprocessed, columns, values, pivotKeys);
121123
}
122124
//delete hierarchy[k];
123125
}
124126
if (k === pivotKeys.level) {
125127
delete hierarchy[k];
126128
}
127129
});
130+
delete hierarchy.processed;
128131
if (this.isLeaf(hierarchy, pivotKeys)) {
129132
delete hierarchy[pivotKeys.records]; /* remove the helper records of the actual records so that
130133
expand indicators can be rendered properly */

0 commit comments

Comments
 (0)