Performance update for resolveFieldData (#4290)
Object.keys can get expensive when called a lot of times. Adding a try catch for the quickest and probably highest use case can lead to big performance gainspull/4142/head
parent
4a7d7e8a64
commit
7f5657bcbd
|
@ -56,6 +56,15 @@ export default {
|
||||||
},
|
},
|
||||||
|
|
||||||
resolveFieldData(data, field) {
|
resolveFieldData(data, field) {
|
||||||
|
try {
|
||||||
|
const value = data[field];
|
||||||
|
if (value)
|
||||||
|
return value;
|
||||||
|
}
|
||||||
|
catch {
|
||||||
|
// do nothing and continue to other methods to resolve field data
|
||||||
|
}
|
||||||
|
|
||||||
if (data && Object.keys(data).length && field) {
|
if (data && Object.keys(data).length && field) {
|
||||||
if (this.isFunction(field)) {
|
if (this.isFunction(field)) {
|
||||||
return field(data);
|
return field(data);
|
||||||
|
|
Loading…
Reference in New Issue