codeant-ai-for-open-source[bot] commented on code in PR #42561:
URL: https://github.com/apache/superset/pull/42561#discussion_r3673271638
##########
superset-frontend/src/dashboard/components/gridComponents/Row/Row.tsx:
##########
@@ -207,6 +211,38 @@ const Row = memo((props: RowProps) => {
observerEnabler.observe(element);
observerDisabler.observe(element);
}
+
+ // Client-side "Download as Image/PDF" (see src/utils/downloadUtils.ts)
+ // dispatches these events so off-screen rows render before the capture
+ // and lazy loading is restored afterwards. Without this, virtualized
+ // charts are exported as loading spinners.
+ const handleForceInView = () => {
+ observerEnabler?.disconnect();
+ observerDisabler?.disconnect();
+ setIsInView(true);
+ };
Review Comment:
**Suggestion:** The force handler unconditionally sets `isInView` to `true`
without checking `isComponentVisibleRef.current`. For rows belonging to hidden
tabs or otherwise invisible dashboard components, this bypasses the visibility
guard used by the normal observer callbacks; `Chart` then treats the row as
renderable and can trigger queries for charts that should remain inactive
during export. Preserve the visibility check when forcing rows into view, or
explicitly exclude invisible components from the force-render path. [incorrect
condition logic]
<details>
<summary><b>Severity Level:</b> Major ⚠️</summary>
```mdx
- ⚠️ Inactive dashboard tabs may issue chart queries during export.
- ⚠️ Exports can trigger unnecessary hidden-chart rendering.
- ⚠️ Large tabbed dashboards may incur extra load.
```
</details>
[](https://app.codeant.ai/fix-in-ide?tool=cursor&prompt_id=a353abf50d744d3eb07b53c634377ef5&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=a353abf50d744d3eb07b53c634377ef5&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/Row/Row.tsx
**Line:** 219:223
**Comment:**
*Incorrect Condition Logic: The force handler unconditionally sets
`isInView` to `true` without checking `isComponentVisibleRef.current`. For rows
belonging to hidden tabs or otherwise invisible dashboard components, this
bypasses the visibility guard used by the normal observer callbacks; `Chart`
then treats the row as renderable and can trigger queries for charts that
should remain inactive during export. Preserve the visibility check when
forcing rows into view, or explicitly exclude invisible components from the
force-render path.
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%2F42561&comment_hash=1b18354ff1ae4cece95d1b164fd69b522c9d4b92e13689460add2388c0c8abee&reaction=like'>👍</a>
| <a
href='https://app.codeant.ai/feedback?pr_url=https%3A%2F%2Fgithub.com%2Fapache%2Fsuperset%2Fpull%2F42561&comment_hash=1b18354ff1ae4cece95d1b164fd69b522c9d4b92e13689460add2388c0c8abee&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]