bito-code-review[bot] commented on PR #43137:
URL: https://github.com/apache/superset/pull/43137#issuecomment-5332500183

   <!-- Bito Reply -->
   The flagged issue is correct. When a chart is opened from a dashboard, the 
modal receives both `dashboardId` and `chart` context. Previously, the payload 
included both, causing the backend to reject the request with a 422 error 
because a report must be associated with either a chart or a dashboard, but not 
both. The fix implemented in the PR correctly uses `creationMethod` to 
conditionally include only the relevant entity (`chart` or `dashboard`) in the 
payload, preventing this conflict.
   
   **superset-frontend/src/features/reports/ReportModal/index.tsx**
   ```
   // A report belongs to either a chart or a dashboard, never both. Explore can
         // carry dashboard context even for a chart-scoped report, so send 
only the
         // entity that matches the creation method; a payload with both 
`chart` and
         // `dashboard` is rejected by the backend with a 422 error.
         ...(creationMethod === CreationMethod.Charts
           ? { chart: chart?.id }
           : { dashboard: dashboardId }),
   ```


-- 
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