Skip to content

Commit 0e90321

Browse files
MKirovaMKirova
authored andcommitted
chore(*): Additional small perf. improvements.
1 parent f160cab commit 0e90321

File tree

1 file changed

+9
-3
lines changed

1 file changed

+9
-3
lines changed

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

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -110,18 +110,24 @@ export class IgxGridUnmergeActivePipe implements PipeTransform {
110110
if (this.grid.hasPinnedRecords && !pinned && this.grid.pinning.rows !== RowPinningPosition.Bottom) {
111111
activeRowIndexes = activeRowIndexes.map(x => x - this.grid.pinnedRecordsCount);
112112
}
113-
const result = cloneArray(collection) as any;
114113
activeRowIndexes = activeRowIndexes.filter((val, idx, arr) => arr.indexOf(val) === idx).filter(x => !isNaN(x));
115114
const rootsToUpdate = [];
116115
activeRowIndexes.forEach(index => {
117116
const target = collection[index];
118117
colsToMerge.forEach(col => {
119118
const colMeta = target.cellMergeMeta.get(col.field);
120-
const root = colMeta.root || target;
121-
rootsToUpdate.push(root);
119+
const root = colMeta.root || (colMeta.rowSpan > 1 ? target : null);
120+
if (root) {
121+
rootsToUpdate.push(root);
122+
}
122123
});
123124
});
124125
const uniqueRoots = rootsToUpdate.filter((val, idx, arr) => arr.indexOf(val) === idx);
126+
if (uniqueRoots.length === 0) {
127+
// if nothing to update, return
128+
return collection;
129+
}
130+
const result = cloneArray(collection) as any;
125131
uniqueRoots.forEach(x => {
126132
const index = result.indexOf(x);
127133
const colKeys = [...x.cellMergeMeta.keys()];

0 commit comments

Comments
 (0)