ramiroaquinoromero commented on code in PR #37112:
URL: https://github.com/apache/superset/pull/37112#discussion_r2730310575
##########
superset-frontend/src/dashboard/components/SliceHeader/index.tsx:
##########
@@ -304,18 +316,20 @@ const SliceHeader = forwardRef<HTMLDivElement,
SliceHeaderProps>(
<FiltersBadge chartId={slice.slice_id} />
)}
- {shouldShowRowLimitWarning && sqlRowCount === rowLimit && (
+ {showRowCountLabel && (
<RowCountLabel
rowcount={sqlRowCount}
limit={rowLimit}
label={
- <Icons.WarningOutlined
- iconSize="l"
- iconColor={theme.colorWarning}
- css={theme => css`
- padding: ${theme.sizeUnit}px;
- `}
- />
+ showRowLimitWarning ? (
+ <Icons.WarningOutlined
+ iconSize="l"
+ iconColor={theme.colorWarning}
+ css={theme => css`
+ padding: ${theme.sizeUnit}px;
+ `}
+ />
+ ) : undefined
Review Comment:
Good morning @msyavuz this is a good point. However, the logic needs to stay
in SliceHeader because:
RowCountLabel is a generic component - it doesn't know about server
pagination or how to extract the total count from the second query response
(lines 198-206). This extraction logic is the actual fix for the bug.
The showRowLimitWarning check determines the visual presentation - it
decides whether to show just the warning icon or the default row count label.
RowCountLabel's internal limitReached logic then wraps whatever we pass with
the tooltip.
Separation of concerns - Moving this logic into RowCountLabel would require
passing queriesResponse, formData, and chart-specific context, making it
tightly coupled to dashboard internals. It's currently also used in SqlLab
where this logic wouldn't apply.
The key fix is passing the correct sqlRowCount (from the second query when
server pagination is enabled) to RowCountLabel, which already handles the
tooltip logic correctly.
--
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]