fix(data-table): compare column class callback

This commit is contained in:
RedwindA
2026-06-15 21:11:46 +08:00
parent 8477f6288b
commit 179f69dfca
@@ -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