Skip to content

Commit d3b412d

Browse files
committed
Tweak logic
1 parent fe0d696 commit d3b412d

File tree

1 file changed

+4
-6
lines changed

1 file changed

+4
-6
lines changed

src/utils/index.ts

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -21,11 +21,6 @@ export function getColumnWidthForMeasurement<R, SR>(
2121
width: number | string,
2222
{ minWidth, maxWidth }: CalculatedColumn<R, SR>
2323
) {
24-
if (width === 'max-content' || width === 'min-content') {
25-
// TODO: how to handle minWidth and maxWidth?
26-
return width;
27-
}
28-
2924
const widthWithUnit = typeof width === 'number' ? `${width}px` : width;
3025

3126
// don't break in Node.js (SSR) and jsdom
@@ -46,7 +41,10 @@ export function getColumnWidthForMeasurement<R, SR>(
4641
if (
4742
hasMaxWidth &&
4843
// ignore maxWidth if it less than minWidth
49-
maxWidth >= minWidth
44+
maxWidth >= minWidth &&
45+
// we do not want to use minmax with max-content as it
46+
// can result in width being larger than max-content
47+
widthWithUnit !== 'max-content'
5048
) {
5149
// We are setting maxWidth on the measuring cell but the browser only applies
5250
// it after all the widths are calculated. This results in left over space in some cases.

0 commit comments

Comments
 (0)