codeant-ai-for-open-source[bot] commented on code in PR #43472:
URL: https://github.com/apache/superset/pull/43472#discussion_r3845702348
##########
superset-frontend/packages/superset-ui-core/src/components/Table/VirtualTable.tsx:
##########
@@ -147,6 +149,28 @@ const VirtualTable = <RecordType extends object>(
const { ref } = useResizeDetector({ onResize });
const theme = useTheme();
+ const cellSize = size === TableSize.Middle ? MIDDLE : SMALL;
+
+ // The header is rendered by antd as a plain `<thead>`, separate from the
+ // react-window `Grid` that renders the body. When the Grid's own vertical
+ // scrollbar appears, it eats into the body's visible column width without
+ // shrinking the header - misaligning the two. Reserve that same space when
+ // sizing columns so both stay in sync (mirrors the fix applied to
+ // `useSticky.tsx` for the non-virtualized table's sticky header).
+ const availableHeight = height || (scroll?.y as number) || 0;
+ // `dataSource` is the full (unpaginated) dataset - when pagination is on,
+ // only a page's worth of rows actually mounts in the Grid at a time, so
+ // that (not the full dataset length) is what determines whether its
+ // vertical scrollbar appears.
+ const pageSize =
+ pagination && typeof pagination === 'object'
+ ? pagination.pageSize
+ : undefined;
+ const rowCount = pageSize ?? dataSource?.length ?? 0;
+ const hasVerticalScroll = rowCount * cellSize > availableHeight;
+ const scrollBarSize = hasVerticalScroll ? getScrollBarSize() : 0;
Review Comment:
**Suggestion:** `hasVerticalScroll` only compares row content height with
the nominal Grid height. When the columns are wider than the Grid, a horizontal
scrollbar consumes part of the vertical viewport; rows that otherwise exactly
fit can then trigger a vertical scrollbar as well. Because that case is not
included here, the header does not reserve the vertical scrollbar width and
becomes misaligned. Determine scrollbar presence using both horizontal and
vertical overflow, including the scrollbar footprint. [incorrect condition
logic]
<details>
<summary><b>Severity Level:</b> Major ⚠️</summary>
```mdx
- ⚠️ Wide virtualized tables can gain an unreserved vertical scrollbar.
- ⚠️ Header cells misalign when horizontal overflow reduces Grid height.
- ⚠️ Drill-detail columns may appear clipped or shifted.
```
</details>
[](https://docs.codeant.ai/cli/resolve-pr-comments-skill)
[](https://app.codeant.ai/fix-in-ide?tool=cursor&prompt_id=311f3d058ac94331878622fcdace8f75&service=github&base_url=https%3A%2F%2Fgithub.com&org=apache&repo=apache%2Fsuperset)
[](https://app.codeant.ai/fix-in-ide?tool=vscode-claude&prompt_id=311f3d058ac94331878622fcdace8f75&service=github&base_url=https%3A%2F%2Fgithub.com&org=apache&repo=apache%2Fsuperset)
<details>
<summary><b>Prompt for AI Agent 🤖 </b></summary>
```mdx
This is a comment left during a code review.
**Path:**
superset-frontend/packages/superset-ui-core/src/components/Table/VirtualTable.tsx
**Line:** 169:171
**Comment:**
*Incorrect Condition Logic: `hasVerticalScroll` only compares row
content height with the nominal Grid height. When the columns are wider than
the Grid, a horizontal scrollbar consumes part of the vertical viewport; rows
that otherwise exactly fit can then trigger a vertical scrollbar as well.
Because that case is not included here, the header does not reserve the
vertical scrollbar width and becomes misaligned. Determine scrollbar presence
using both horizontal and vertical overflow, including the scrollbar footprint.
Validate the correctness of the flagged issue. If correct, How can I resolve
this? If you propose a fix, implement it and please make it concise.
Once fix is implemented, also check other comments on the same PR, and ask
user if the user wants to fix the rest of the comments as well. if said yes,
then fetch all the comments validate the correctness and implement a minimal fix
```
</details>
<a
href='https://app.codeant.ai/feedback?pr_url=https%3A%2F%2Fgithub.com%2Fapache%2Fsuperset%2Fpull%2F43472&comment_hash=6e524628a2b487abfd0b5227572db0c2f8fad96fbf093b8b640dbc59a3f34ae4&reaction=like'>👍</a>
| <a
href='https://app.codeant.ai/feedback?pr_url=https%3A%2F%2Fgithub.com%2Fapache%2Fsuperset%2Fpull%2F43472&comment_hash=6e524628a2b487abfd0b5227572db0c2f8fad96fbf093b8b640dbc59a3f34ae4&reaction=dislike'>👎</a>
--
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]