diff --git a/components/lib/datatable/TableBody.js b/components/lib/datatable/TableBody.js index 4bcefb09e0..0a43916d7a 100644 --- a/components/lib/datatable/TableBody.js +++ b/components/lib/datatable/TableBody.js @@ -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; } @@ -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; } diff --git a/components/lib/utils/ObjectUtils.js b/components/lib/utils/ObjectUtils.js index 14da588157..2bcc3b0cc2 100644 --- a/components/lib/utils/ObjectUtils.js +++ b/components/lib/utils/ObjectUtils.js @@ -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); } /**