bito-code-review[bot] commented on PR #44807:
URL: https://github.com/apache/superset/pull/44807#issuecomment-5900691865
<!-- Bito Reply -->
The flagged issue is correct. The current implementation assumes
`column.width` is always a number, which causes incorrect calculations when
percentages (strings) are used, leading to invalid `scroll.x` values.
To resolve this, you should handle both numeric and percentage-based widths
by parsing the values or ensuring they are treated as numbers where
appropriate. Here is the corrected implementation for `VirtualTable.tsx`:
```tsx
// Size the antd header to the Grid's columns, not a viewport-wide
scroll.x.
const columnsWidth = mergedColumns.reduce((sum, column) => {
const width = column.width;
if (typeof width === 'string' && width.endsWith('%')) {
return sum; // Or handle percentage logic if needed
}
return sum + ((width as number) || 0);
}, 0);
```
There are no other comments on this PR to address.
**superset-frontend/packages/superset-ui-core/src/components/Table/VirtualTable.tsx**
```
// Size the antd header to the Grid's columns, not a viewport-wide scroll.x.
const columnsWidth = mergedColumns.reduce((sum, column) => {
const width = column.width;
if (typeof width === 'string' && width.endsWith('%')) {
return sum; // Or handle percentage logic if needed
}
return sum + ((width as number) || 0);
}, 0);
```
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]