diff --git a/packages/table-core/src/core/row.ts b/packages/table-core/src/core/row.ts index 0af28aa94c..6010cb6dc3 100644 --- a/packages/table-core/src/core/row.ts +++ b/packages/table-core/src/core/row.ts @@ -167,15 +167,12 @@ export const createRow = ( } return parentRows.reverse() }, - getAllCells: memo( - () => [table.getAllLeafColumns()], - leafColumns => { - return leafColumns.map(column => { - return createCell(table, row as Row, column, column.id) - }) - }, - getMemoOptions(table.options, 'debugRows', 'getAllCells') - ), + getAllCells: () => { + const leafColumns = table.getAllLeafColumns() + return leafColumns.map(column => { + return createCell(table, row as Row, column, column.id) + }) + }, _getAllCellsByColumnId: memo( () => [row.getAllCells()], diff --git a/packages/table-core/src/features/ColumnPinning.ts b/packages/table-core/src/features/ColumnPinning.ts index 1c0ef70799..ec0746c2bd 100644 --- a/packages/table-core/src/features/ColumnPinning.ts +++ b/packages/table-core/src/features/ColumnPinning.ts @@ -240,43 +240,40 @@ export const ColumnPinning: TableFeature = { row: Row, table: Table ): void => { - row.getCenterVisibleCells = memo( - () => [ + row.getCenterVisibleCells = () => { + const [allCells, left, right] = [ row._getAllVisibleCells(), table.getState().columnPinning.left, table.getState().columnPinning.right, - ], - (allCells, left, right) => { - const leftAndRight: string[] = [...(left ?? []), ...(right ?? [])] + ] + const leftAndRight: string[] = [...(left ?? []), ...(right ?? [])] - return allCells.filter(d => !leftAndRight.includes(d.column.id)) - }, - getMemoOptions(table.options, 'debugRows', 'getCenterVisibleCells') - ) - row.getLeftVisibleCells = memo( - () => [row._getAllVisibleCells(), table.getState().columnPinning.left], - (allCells, left) => { - const cells = (left ?? []) - .map(columnId => allCells.find(cell => cell.column.id === columnId)!) - .filter(Boolean) - .map(d => ({ ...d, position: 'left' }) as Cell) + return allCells.filter(d => !leftAndRight.includes(d.column.id)) + } + row.getLeftVisibleCells = () => { + const [allCells, left] = [ + row._getAllVisibleCells(), + table.getState().columnPinning.left, + ] + const cells = (left ?? []) + .map(columnId => allCells.find(cell => cell.column.id === columnId)!) + .filter(Boolean) + .map(d => ({ ...d, position: 'left' }) as Cell) - return cells - }, - getMemoOptions(table.options, 'debugRows', 'getLeftVisibleCells') - ) - row.getRightVisibleCells = memo( - () => [row._getAllVisibleCells(), table.getState().columnPinning.right], - (allCells, right) => { - const cells = (right ?? []) - .map(columnId => allCells.find(cell => cell.column.id === columnId)!) - .filter(Boolean) - .map(d => ({ ...d, position: 'right' }) as Cell) + return cells + } + row.getRightVisibleCells = () => { + const [allCells, right] = [ + row._getAllVisibleCells(), + table.getState().columnPinning.right, + ] + const cells = (right ?? []) + .map(columnId => allCells.find(cell => cell.column.id === columnId)!) + .filter(Boolean) + .map(d => ({ ...d, position: 'right' }) as Cell) - return cells - }, - getMemoOptions(table.options, 'debugRows', 'getRightVisibleCells') - ) + return cells + } }, createTable: (table: Table): void => { diff --git a/packages/table-core/src/features/ColumnVisibility.ts b/packages/table-core/src/features/ColumnVisibility.ts index f37e57be8e..d6597405e5 100644 --- a/packages/table-core/src/features/ColumnVisibility.ts +++ b/packages/table-core/src/features/ColumnVisibility.ts @@ -205,22 +205,17 @@ export const ColumnVisibility: TableFeature = { row: Row, table: Table ): void => { - row._getAllVisibleCells = memo( - () => [row.getAllCells(), table.getState().columnVisibility], - cells => { - return cells.filter(cell => cell.column.getIsVisible()) - }, - getMemoOptions(table.options, 'debugRows', '_getAllVisibleCells') - ) - row.getVisibleCells = memo( - () => [ - row.getLeftVisibleCells(), - row.getCenterVisibleCells(), - row.getRightVisibleCells(), - ], - (left, center, right) => [...left, ...center, ...right], - getMemoOptions(table.options, 'debugRows', 'getVisibleCells') - ) + row._getAllVisibleCells = () => { + const cells = row.getAllCells() + return cells.filter(cell => cell.column.getIsVisible()) + } + row.getVisibleCells = () => { + return [ + ...row.getLeftVisibleCells(), + ...row.getCenterVisibleCells(), + ...row.getRightVisibleCells(), + ] + } }, createTable: (table: Table): void => {