Skip to content

Commit b6d664b

Browse files
committed
[hotfix/4457]
- performance improvement
1 parent 3dc24a7 commit b6d664b

File tree

1 file changed

+13
-4
lines changed
  • packages/core/src/js/factories

1 file changed

+13
-4
lines changed

packages/core/src/js/factories/Grid.js

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1128,14 +1128,23 @@ angular.module('ui.grid')
11281128
*/
11291129
Grid.prototype.findRowByKey = function findRowByKey(isInEntity, key, comparator, lookInRows) {
11301130
lookInRows = lookInRows == void 0 ? this.rows : lookInRows;
1131+
var result = null;
11311132
var func = isInEntity ? function (row) {
1132-
return row.entity != void 0 && row.entity[key] === comparator;
1133+
if ( row.entity != void 0 && row.entity[key] === comparator ) {
1134+
result = row;
1135+
return false;
1136+
}
1137+
return true;
11331138
} : function (row) {
1134-
return row[key] === comparator;
1139+
if ( row[key] === comparator ) {
1140+
result = row;
1141+
return false;
1142+
}
1143+
return true;
11351144
}
11361145

1137-
rows = lookInRows.filter(func);
1138-
return rows.length > 0 ? rows[0] : null;
1146+
lookInRows.every(func);
1147+
return result
11391148
};
11401149

11411150
/**

0 commit comments

Comments
 (0)