codeant-ai-for-open-source[bot] commented on code in PR #42316:
URL: https://github.com/apache/superset/pull/42316#discussion_r3639026843


##########
superset-frontend/src/explore/components/ExploreViewContainer/index.tsx:
##########
@@ -1241,6 +1243,7 @@ function mapStateToProps(state: ExploreRootState) {
     table_name: datasource.table_name,
     vizType: form_data.viz_type,
     standalone: !!explore.standalone,
+    showDownload: !!getUrlParam(URL_PARAMS.showDownload),

Review Comment:
   **Suggestion:** Coercing the URL param with double-negation treats any 
non-empty value (including `0`/`false`) as enabled, so the download UI can be 
shown when callers explicitly try to disable it. Parse the param value 
explicitly (for example, only enable when it equals `1`/`true`) instead of 
using truthiness. [logic error]
   
   <details>
   <summary><b>Severity Level:</b> Major ⚠️</summary>
   
   ```mdx
   - ⚠️ Standalone explore iframes ignore explicit download disable flags.
   - ⚠️ Embedders cannot distinguish enabled from falsey query values.
   - ⚠️ Confusing API contract for showDownload URL parameter.
   ```
   </details>
   <details>
   <summary><b>Steps of Reproduction ✅ </b></summary>
   
   ```mdx
   1. Open a standalone Explore chart route that renders `ExploreViewContainer` 
(function
   `ExploreViewContainer` in
   `superset-frontend/src/explore/components/ExploreViewContainer/index.tsx`, 
around line
   905) and append `?showDownload=false` (or `?showDownload=0`) to the URL 
query string.
   
   2. In `mapStateToProps` (same file, lines 1233–1247), the expression
   `getUrlParam(URL_PARAMS.showDownload)` at line 1246 reads the query param 
value and
   returns the string `"false"` or `"0"` when that is present in the URL.
   
   3. The double negation in `showDownload: 
!!getUrlParam(URL_PARAMS.showDownload),` at line
   1246 coerces any non-empty string (including `"false"`/`"0"`) to the boolean 
`true`, so
   `showDownload` in the mapped props becomes `true` even though the caller 
specified a
   disabling value.
   
   4. `ExploreViewContainer` then passes `showDownload={props.showDownload}` to 
its child JSX
   element (lines 905–919), causing the download UI to render in the standalone 
chart iframe,
   and the caller’s attempt to disable the control via `showDownload=false`/`0` 
is ignored.
   ```
   </details>
   
   [![Fix in 
Cursor](https://new-codeant-butcket.s3.us-west-1.amazonaws.com/badges/fix-in-cursor-flat.svg)](https://app.codeant.ai/fix-in-ide?tool=cursor&prompt_id=7f77725545704dd5b7a30596dc4adf8b&service=github&base_url=https%3A%2F%2Fgithub.com&org=apache&repo=apache%2Fsuperset)
 [![Fix in VSCode 
Claude](https://new-codeant-butcket.s3.us-west-1.amazonaws.com/badges/fix-in-vscode-claude-flat.svg)](https://app.codeant.ai/fix-in-ide?tool=vscode-claude&prompt_id=7f77725545704dd5b7a30596dc4adf8b&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/explore/components/ExploreViewContainer/index.tsx
   **Line:** 1246:1246
   **Comment:**
        *Logic Error: Coercing the URL param with double-negation treats any 
non-empty value (including `0`/`false`) as enabled, so the download UI can be 
shown when callers explicitly try to disable it. Parse the param value 
explicitly (for example, only enable when it equals `1`/`true`) instead of 
using truthiness.
   
   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%2F42316&comment_hash=6ff0fb8a25a85db3784b57ca7101cfa3f3d70d53ee9eb41470023d87c3ae849e&reaction=like'>👍</a>
 | <a 
href='https://app.codeant.ai/feedback?pr_url=https%3A%2F%2Fgithub.com%2Fapache%2Fsuperset%2Fpull%2F42316&comment_hash=6ff0fb8a25a85db3784b57ca7101cfa3f3d70d53ee9eb41470023d87c3ae849e&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]

Reply via email to