fix(data-table): compare column class callback
This commit is contained in:
@@ -62,14 +62,12 @@ function DataTableRowInner<TData>({
|
||||
}
|
||||
|
||||
const MemoizedDataTableRow = React.memo(DataTableRowInner, (prev, next) => {
|
||||
// Skip re-render when only the getColumnClassName reference changed but the
|
||||
// row identity and captured selection state are the same. Callers rarely
|
||||
// stabilize this callback, so excluding it from comparison avoids unnecessary
|
||||
// renders. Do not read row.getIsSelected() here: TanStack row objects may keep
|
||||
// a stable reference while their selection state changes.
|
||||
// Do not read row.getIsSelected() here: TanStack row objects may keep a stable
|
||||
// reference while their selection state changes.
|
||||
return (
|
||||
prev.row === next.row &&
|
||||
prev.className === next.className &&
|
||||
prev.getColumnClassName === next.getColumnClassName &&
|
||||
prev.isSelected === next.isSelected
|
||||
)
|
||||
}) as typeof DataTableRowInner
|
||||
|
||||
Reference in New Issue
Block a user