Skip to content

Commit 9eb88cd

Browse files
MKirovaMKirova
authored andcommitted
Ensure data is not poluted by using copies.
1 parent 9fb3e34 commit 9eb88cd

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

projects/igniteui-angular/src/lib/grids/pivot-grid/pivot-grid.pipes.ts

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,8 @@ export class IgxPivotRowPipe implements PipeTransform {
3535
): any[] {
3636
const enabledRows = config.rows.filter(x => x.enabled);
3737
const rowStrategy = config.rowStrategy || PivotRowDimensionsStrategy.instance();
38-
return rowStrategy.process(collection.slice(0), enabledRows, config.values, pivotKeys);
38+
const data = cloneArray(collection, true);
39+
return rowStrategy.process(data, enabledRows, config.values, pivotKeys);
3940
}
4041
}
4142

@@ -59,7 +60,7 @@ export class IgxPivotRowExpansionPipe implements PipeTransform {
5960
pivotKeys: IPivotKeys = { aggregations: 'aggregations', records: 'records', children: 'children', level: 'level' }
6061
): any[] {
6162
const enabledRows = config.rows.filter(x => x.enabled);
62-
const data = collection ? collection.slice(0) : [];
63+
const data = collection ? cloneArray(collection, true) : [];
6364
let totalLlv = 0;
6465
const prevDims = [];
6566
for (const row of enabledRows) {
@@ -107,7 +108,8 @@ export class IgxPivotColumnPipe implements PipeTransform {
107108
const enabledValues = config.values.filter(x => x.enabled);
108109

109110
const colStrategy = config.columnStrategy || PivotColumnDimensionsStrategy.instance();
110-
return colStrategy.process(collection, enabledColumns, enabledValues, pivotKeys);
111+
const data = cloneArray(collection, true);
112+
return colStrategy.process(data, enabledColumns, enabledValues, pivotKeys);
111113
}
112114
}
113115

@@ -146,7 +148,7 @@ export class IgxPivotGridFilterPipe implements PipeTransform {
146148
return collection;
147149
}
148150

149-
const result = DataUtil.filter(cloneArray(collection), state, this.gridAPI.grid);
151+
const result = DataUtil.filter(cloneArray(collection, true), state, this.gridAPI.grid);
150152

151153
return result;
152154
}

0 commit comments

Comments
 (0)