Skip to content

Commit

Permalink
Merge pull request #1541 from nickgros/SWC-7236
Browse files Browse the repository at this point in the history
  • Loading branch information
nickgros authored Jan 31, 2025
2 parents bc7bcfe + 693c516 commit eff9e9f
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -153,6 +153,7 @@ export function SynapseTable(props: SynapseTableProps) {
id: selectColumn.name,
enableSorting: isSortableColumn(selectColumn.columnType),
enableResizing: true,
size: 200,
header: TableDataColumnHeader,
cell: TableDataCell,
})
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -73,10 +73,15 @@ export default function StyledTanStackTable<
header.column.getSize()
}
return colSizes
// Intentionally limit the dependencies to only recompute when the column sizes change
// eslint-disable-next-line react-hooks/exhaustive-deps
}, [table.getState().columnSizingInfo, table.getState().columnSizing])
}, [
table.getState().columnSizingInfo,
table.getState().columnSizing,
table.getState().columnVisibility, // If a column is added, its width should be recalculated
])

const tableWidth = fullWidth ? '100%' : table.getTotalSize()
const tableWidth = fullWidth ? '100%' : `${table.getTotalSize()}px`

/* When resizing any column we will render this special memoized version of our table body */
const TableBodyElement = table.getState().columnSizingInfo.isResizingColumn
Expand All @@ -89,6 +94,7 @@ export default function StyledTanStackTable<
{...tableSlotProps}
style={{
...columnSizeVars,
tableLayout: 'fixed',
width: tableWidth,
...tableSlotProps['style'],
}}
Expand Down

0 comments on commit eff9e9f

Please sign in to comment.