codeant-ai-for-open-source[bot] commented on code in PR #37141:
URL: https://github.com/apache/superset/pull/37141#discussion_r3707328729
##########
superset-frontend/src/dashboard/components/gridComponents/ChartHolder/ChartHolder.tsx:
##########
@@ -182,11 +197,29 @@ const ChartHolder = ({
}, [
component,
getComponentById,
+ isMobile,
+ editMode,
parentComponent.meta.width,
parentComponent.parents,
parentComponent.type,
]);
+ // Grid units of height for this chart. In mobile consumption mode the
+ // authored desktop height is capped to the viewport (minus app chrome) so
+ // tall charts don't dominate the single-column stacked layout. Used for
+ // both the ResizableContainer shell and the height handed to the plugin,
+ // so the two can't disagree.
+ const heightMultiple = useMemo(() => {
+ const authoredHeight = component.meta.height ?? GRID_MIN_ROW_UNITS;
+ if (isMobile && !editMode) {
+ const maxUnits = Math.floor(
+ (window.innerHeight - MOBILE_CHROME_HEIGHT) / GRID_BASE_UNIT,
+ );
+ return Math.max(GRID_MIN_ROW_UNITS, Math.min(authoredHeight, maxUnits));
+ }
+ return authoredHeight;
+ }, [component.meta.height, isMobile, editMode]);
Review Comment:
**Suggestion:** The height cap reads `window.innerHeight` only while
computing the memo, but viewport height is not a dependency and `useIsMobile()`
only updates when the width breakpoint changes. Rotating the device or resizing
within the mobile breakpoint therefore leaves `heightMultiple`, the chart
height, and the resizable shell stuck at the previous viewport height.
Subscribe to viewport resize/orientation changes or derive this value from
responsive state that updates on height changes. [stale reference]
<details>
<summary><b>Severity Level:</b> Major ⚠️</summary>
```mdx
- ⚠️ Mobile chart heights become stale after vertical viewport changes.
- ⚠️ Dashboard charts may remain too tall or too short.
- ⚠️ Mobile browser chrome changes produce incorrect chart sizing.
```
</details>
[](https://app.codeant.ai/fix-in-ide?tool=cursor&prompt_id=5f0c6a0d1dc44e9bae6220e8a2ff636e&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=5f0c6a0d1dc44e9bae6220e8a2ff636e&service=github&base_url=https%3A%2F%2Fgithub.com&org=apache&repo=apache%2Fsuperset)
*(Use Cmd/Ctrl + Click for best experience)*
<details>
<summary><b>Prompt for AI Agent 🤖 </b></summary>
```mdx
This is a comment left during a code review.
**Path:**
superset-frontend/src/dashboard/components/gridComponents/ChartHolder/ChartHolder.tsx
**Line:** 212:221
**Comment:**
*Stale Reference: The height cap reads `window.innerHeight` only while
computing the memo, but viewport height is not a dependency and `useIsMobile()`
only updates when the width breakpoint changes. Rotating the device or resizing
within the mobile breakpoint therefore leaves `heightMultiple`, the chart
height, and the resizable shell stuck at the previous viewport height.
Subscribe to viewport resize/orientation changes or derive this value from
responsive state that updates on height changes.
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%2F37141&comment_hash=32afcdbf176ff8ccbf5387998c567c7a60d162834b42e90ebdc8a5a222d21981&reaction=like'>👍</a>
| <a
href='https://app.codeant.ai/feedback?pr_url=https%3A%2F%2Fgithub.com%2Fapache%2Fsuperset%2Fpull%2F37141&comment_hash=32afcdbf176ff8ccbf5387998c567c7a60d162834b42e90ebdc8a5a222d21981&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]