Skip to content

Commit eff9e9f

Browse files
authored
Merge pull request #1541 from nickgros/SWC-7236
2 parents bc7bcfe + 693c516 commit eff9e9f

File tree

2 files changed

+9
-2
lines changed

2 files changed

+9
-2
lines changed

packages/synapse-react-client/src/components/SynapseTable/SynapseTable.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -153,6 +153,7 @@ export function SynapseTable(props: SynapseTableProps) {
153153
id: selectColumn.name,
154154
enableSorting: isSortableColumn(selectColumn.columnType),
155155
enableResizing: true,
156+
size: 200,
156157
header: TableDataColumnHeader,
157158
cell: TableDataCell,
158159
})

packages/synapse-react-client/src/components/TanStackTable/StyledTanStackTable.tsx

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -73,10 +73,15 @@ export default function StyledTanStackTable<
7373
header.column.getSize()
7474
}
7575
return colSizes
76+
// Intentionally limit the dependencies to only recompute when the column sizes change
7677
// eslint-disable-next-line react-hooks/exhaustive-deps
77-
}, [table.getState().columnSizingInfo, table.getState().columnSizing])
78+
}, [
79+
table.getState().columnSizingInfo,
80+
table.getState().columnSizing,
81+
table.getState().columnVisibility, // If a column is added, its width should be recalculated
82+
])
7883

79-
const tableWidth = fullWidth ? '100%' : table.getTotalSize()
84+
const tableWidth = fullWidth ? '100%' : `${table.getTotalSize()}px`
8085

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

0 commit comments

Comments
 (0)