@@ -47,6 +47,7 @@ export function getCellProps<RecordType>(
4747 expandedRowOffset = 0 ,
4848 rowStickyOffsets ?: ReturnType < typeof useStickyOffsets > ,
4949 hasColSpanZero ?: boolean ,
50+ cachedCellProps ?: Record < string , any > ,
5051) {
5152 const {
5253 record,
@@ -68,7 +69,7 @@ export function getCellProps<RecordType>(
6869 const key = columnsKey [ colIndex ] ;
6970 let fixedInfo = fixedInfoList [ colIndex ] ;
7071
71- if ( column . fixed && hasColSpanZero ) {
72+ if ( column . fixed && hasColSpanZero && rowStickyOffsets ) {
7273 fixedInfo = getCellFixedInfo ( colIndex , colIndex , flattenColumns , rowStickyOffsets ) ;
7374 }
7475 let appendCellNode : React . ReactNode ;
@@ -90,7 +91,7 @@ export function getCellProps<RecordType>(
9091 ) ;
9192 }
9293
93- const additionalCellProps = column . onCell ?.( record , index ) || { } ;
94+ const additionalCellProps = cachedCellProps || column . onCell ?.( record , index ) || { } ;
9495
9596 // Expandable row has offset
9697 if ( expandedRowOffset ) {
@@ -160,13 +161,14 @@ function BodyRow<RecordType extends { children?: readonly RecordType[] }>(
160161 rowSupportExpand,
161162 } = rowInfo ;
162163
163- const hasColSpanZero = React . useMemo ( ( ) => {
164- return flattenColumns . some ( col => {
165- const cellProps = col . onCell ?.( record , index ) || { } ;
166- return ( cellProps . colSpan ?? 1 ) === 0 ;
167- } ) ;
164+ const cellPropsCache = React . useMemo ( ( ) => {
165+ return flattenColumns . map ( col => col . onCell ?.( record , index ) || { } ) ;
168166 } , [ flattenColumns , record , index ] ) ;
169167
168+ const hasColSpanZero = React . useMemo ( ( ) => {
169+ return cellPropsCache . some ( cellProps => ( cellProps . colSpan ?? 1 ) === 0 ) ;
170+ } , [ cellPropsCache ] ) ;
171+
170172 const rowStickyOffsets = useStickyOffsets (
171173 colWidths ,
172174 flattenColumns ,
@@ -219,6 +221,7 @@ function BodyRow<RecordType extends { children?: readonly RecordType[] }>(
219221 expandedRowInfo ?. offset ,
220222 rowStickyOffsets ,
221223 hasColSpanZero ,
224+ cellPropsCache [ colIndex ] ,
222225 ) ;
223226
224227 return (
0 commit comments