mirror of
https://github.com/QuantumNous/new-api.git
synced 2026-09-06 17:46:23 +00:00
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) => {
|
const MemoizedDataTableRow = React.memo(DataTableRowInner, (prev, next) => {
|
||||||
// Skip re-render when only the getColumnClassName reference changed but the
|
// Do not read row.getIsSelected() here: TanStack row objects may keep a stable
|
||||||
// row identity and captured selection state are the same. Callers rarely
|
// reference while their selection state changes.
|
||||||
// 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.
|
|
||||||
return (
|
return (
|
||||||
prev.row === next.row &&
|
prev.row === next.row &&
|
||||||
prev.className === next.className &&
|
prev.className === next.className &&
|
||||||
|
prev.getColumnClassName === next.getColumnClassName &&
|
||||||
prev.isSelected === next.isSelected
|
prev.isSelected === next.isSelected
|
||||||
)
|
)
|
||||||
}) as typeof DataTableRowInner
|
}) as typeof DataTableRowInner
|
||||||
|
|||||||
Reference in New Issue
Block a user