From 7f5657bcbd4cc714e725719ae0a4e07edd61c883 Mon Sep 17 00:00:00 2001 From: MoMack20 Date: Mon, 4 Sep 2023 22:08:36 -0400 Subject: [PATCH] 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 gains --- components/lib/utils/ObjectUtils.js | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/components/lib/utils/ObjectUtils.js b/components/lib/utils/ObjectUtils.js index 1b665c797..d3a101004 100755 --- a/components/lib/utils/ObjectUtils.js +++ b/components/lib/utils/ObjectUtils.js @@ -56,6 +56,15 @@ export default { }, 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 (this.isFunction(field)) { return field(data);