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


##########
superset-frontend/src/explore/components/useExploreAdditionalActionsMenu/index.tsx:
##########
@@ -1018,6 +1018,7 @@ export const useExploreAdditionalActionsMenu = (
           modalBody={
             <ViewQueryModal
               latestQueryFormData={latestQueryFormData as QueryFormData}
+              ownState={ownState}

Review Comment:
   **Suggestion:** Passing raw `ownState` into `ViewQueryModal` forwards 
`clientView` (rows/columns) into `getChartDataRequest`, but query paths 
elsewhere explicitly strip `clientView` before backend requests. This can bloat 
the payload and cause View Query failures/timeouts (or 413) on large tables. 
Pass a sanitized `ownState` that omits `clientView` for View Query, keeping 
only server-relevant state like search/sort keys. [api mismatch]
   
   <details>
   <summary><b>Severity Level:</b> Major ⚠️</summary>
   
   ```mdx
   - ⚠️ Explore "View query" may fail on large table charts.
   - ⚠️ Oversized payloads increase latency for View Query calls.
   - ⚠️ Inconsistent behavior vs. other paths that strip clientView.
   ```
   </details>
   <details>
   <summary><b>Steps of Reproduction ✅ </b></summary>
   
   ```mdx
   1. Configure a Table chart using the table plugin so that it renders many 
rows
   client-side; `plugins/plugin-chart-table/src/TableChart.tsx` around lines 
1563–1594 shows
   `clientViewRows` being tracked and written into `ownState.clientView` (with 
`rows`,
   `columns`, and `count`) via `updateTableOwnState`.
   
   2. Open that chart in Explore so that the Explore view uses the same plugin 
and data mask
   wiring; the TableChart component will push a large `clientView` snapshot 
(all filtered
   rows and visible columns) into the chart's `ownState`.
   
   3. In the Explore header, open the actions menu and click "View query"; the 
menu item is
   wired via `src/explore/components/useExploreAdditionalActionsMenu/index.tsx` 
lines 30–43,
   which render a `ModalTrigger` whose `modalBody` mounts `<ViewQueryModal
   latestQueryFormData={latestQueryFormData as QueryFormData} 
ownState={ownState} />`.
   
   4. When the `ViewQueryModal` mounts, its `useEffect` calls 
`loadChartData('query')`, which
   in turn calls `getChartDataRequest` with `ownState` unchanged
   (`src/explore/components/controls/ViewQueryModal.tsx` lines 53–65). Because 
`ownState` now
   includes the large `clientView` snapshot, the POST body sent by 
`getChartDataRequest`
   (defined in `src/components/Chart/chartAction.ts` lines 504–513) can become 
very large and
   include thousands of rows and columns. On sufficiently large tables this 
inflated payload
   can cause the View Query request to be slow or rejected by the server (e.g., 
413 Payload
   Too Large), breaking the View Query dialog specifically for table charts 
with extensive
   client-side filtering.
   ```
   </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=231c650de0204c36a9eace7618134da3&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=231c650de0204c36a9eace7618134da3&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/useExploreAdditionalActionsMenu/index.tsx
   **Line:** 1021:1021
   **Comment:**
        *Api Mismatch: Passing raw `ownState` into `ViewQueryModal` forwards 
`clientView` (rows/columns) into `getChartDataRequest`, but query paths 
elsewhere explicitly strip `clientView` before backend requests. This can bloat 
the payload and cause View Query failures/timeouts (or 413) on large tables. 
Pass a sanitized `ownState` that omits `clientView` for View Query, keeping 
only server-relevant state like search/sort keys.
   
   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%2F35208&comment_hash=332bfecb5927a28a5bbfa5473ecb79ed3c325970d33baa42a641fadf1072b22a&reaction=like'>👍</a>
 | <a 
href='https://app.codeant.ai/feedback?pr_url=https%3A%2F%2Fgithub.com%2Fapache%2Fsuperset%2Fpull%2F35208&comment_hash=332bfecb5927a28a5bbfa5473ecb79ed3c325970d33baa42a641fadf1072b22a&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