We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 2ca4058 commit 5a70954Copy full SHA for 5a70954
packages/core/src/data-editor/use-column-sizer.ts
@@ -133,8 +133,12 @@ export function useColumnSizer(
133
}
134
sizes.push(ctx.measureText(c.title).width + 16 + (c.icon === undefined ? 0 : 28));
135
const average = sizes.reduce((a, b) => a + b) / sizes.length;
136
- const biggest = sizes.reduce((a, acc) => (a > average * 2 ? acc : Math.max(acc, a)));
137
-
+ if (sizes.length > 5) {
+ // Filter out outliers
138
+ sizes = sizes.filter(a => a < average * 2);
139
+ }
140
+ const biggest = Math.max(...sizes);
141
+
142
const final = Math.max(minColumnWidth, Math.min(maxColumnWidth, Math.ceil(biggest)));
143
memoMap.current[c.id] = final;
144
0 commit comments