sadpandajoe commented on code in PR #43137:
URL: https://github.com/apache/superset/pull/43137#discussion_r3817297036


##########
superset-frontend/src/features/reports/ReportModal/index.tsx:
##########
@@ -189,8 +189,13 @@ function ReportModal({
       active: true,
       force_screenshot: false,
       custom_width: currentReport.custom_width,
-      dashboard: dashboardId,
-      chart: chart?.id,
+      // 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 }),

Review Comment:
   Fixed in 49df51eb26d8bd9887d37df520f58e9e1c0d56b2. The edit-mode selector 
now resolves the report to edit using the same `creationMethod`-based scope/id 
the save payload already uses (mirroring the fix below it), with a regression 
test covering a chart opened from a dashboard (both `chart` and `dashboardId` 
set). The sibling `dashboardId`-first pattern in `useHeaderReportMenuItems` 
(HeaderReportDropdown) is a separate, out-of-scope case since that hook doesn't 
receive `creationMethod` — tracking as a follow-up rather than folding it into 
this PR.



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