Skip to content

Commit

Permalink
Fix primefaces#5651: GroupRowsBy handle dates and objects
Browse files Browse the repository at this point in the history
  • Loading branch information
melloware committed Dec 29, 2023
1 parent 47d5663 commit d9e85c7
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 4 deletions.
4 changes: 2 additions & 2 deletions components/lib/datatable/TableBody.js
Original file line number Diff line number Diff line change
Expand Up @@ -205,7 +205,7 @@ export const TableBody = React.memo(
if (prevRowData) {
const previousRowFieldData = ObjectUtils.resolveFieldData(prevRowData, props.groupRowsBy);

return currentRowFieldData !== previousRowFieldData;
return !ObjectUtils.deepEquals(currentRowFieldData, previousRowFieldData);
} else {
return true;
}
Expand All @@ -221,7 +221,7 @@ export const TableBody = React.memo(
if (nextRowData) {
const nextRowFieldData = ObjectUtils.resolveFieldData(nextRowData, props.groupRowsBy);

return currentRowFieldData !== nextRowFieldData;
return !ObjectUtils.deepEquals(currentRowFieldData, nextRowFieldData);
} else {
return true;
}
Expand Down
7 changes: 5 additions & 2 deletions components/lib/utils/ObjectUtils.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
export default class ObjectUtils {
static equals(obj1, obj2, field) {
if (field && obj1 && typeof obj1 === 'object' && obj2 && typeof obj2 === 'object') return this.resolveFieldData(obj1, field) === this.resolveFieldData(obj2, field);
else return this.deepEquals(obj1, obj2);
if (field && obj1 && typeof obj1 === 'object' && obj2 && typeof obj2 === 'object') {
return this.deepEquals(this.resolveFieldData(obj1, field), this.resolveFieldData(obj2, field));
}

return this.deepEquals(obj1, obj2);
}

/**
Expand Down

0 comments on commit d9e85c7

Please sign in to comment.