Skip to content

Commit 42acc94

Browse files
committed
Tweak
1 parent b497648 commit 42acc94

File tree

1 file changed

+5
-6
lines changed

1 file changed

+5
-6
lines changed

src/hooks/useColumnWidths.ts

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -89,19 +89,18 @@ export function useColumnWidths<R, SR>(
8989
function handleColumnResize(column: CalculatedColumn<R, SR>, nextWidth: ResizedWidth) {
9090
const { key: resizingKey } = column;
9191

92-
setMeasuredColumnWidths((measuredColumnWidths) => {
93-
if (columnsCanFlex) {
92+
if (columnsCanFlex) {
93+
// delete measured column widths for all other flex columns so they can be recalculated
94+
setMeasuredColumnWidths((measuredColumnWidths) => {
9495
const newMeasuredColumnWidths = new Map(measuredColumnWidths);
9596
for (const { key, width } of viewportColumns) {
9697
if (resizingKey !== key && typeof width === 'string' && !resizedColumnWidths.has(key)) {
9798
newMeasuredColumnWidths.delete(key);
9899
}
99100
}
100101
return newMeasuredColumnWidths;
101-
}
102-
103-
return measuredColumnWidths;
104-
});
102+
});
103+
}
105104

106105
setColumnToAutoResize({
107106
key: resizingKey,

0 commit comments

Comments
 (0)