Skip to content

Commit

Permalink
Fix primefaces#4797: ObjectUtils.resolveFieldData perf improvement
Browse files Browse the repository at this point in the history
  • Loading branch information
melloware committed Aug 18, 2023
1 parent a091ce7 commit 7173ff8
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions components/lib/utils/ObjectUtils.js
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,15 @@ export default class ObjectUtils {
}

static resolveFieldData(data, field) {
try {
const value = data[field];

if (value) return value;
} catch {
// Performance optimization: https://github.com/primefaces/primereact/issues/4797
// 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);
Expand Down

0 comments on commit 7173ff8

Please sign in to comment.