You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@superset.apache.org by "mostopalove (via GitHub)" <gi...@apache.org> on 2025/03/13 10:32:41 UTC
[PR] fix(dashboard): Ensure `dashboardId` is included in `form_data` for embedded mode [superset]
mostopalove opened a new pull request, #32646:
URL: https://github.com/apache/superset/pull/32646
<!---
Please write the PR title following the conventions at https://www.conventionalcommits.org/en/v1.0.0/
Example:
fix(dashboard): load charts correctly
-->
### SUMMARY
<!--- Describe the change below, including rationale and design decisions -->
This PR fixes an issue where charts fail to load in **Apache Superset’s embedded mode** when using the **Gamma role** for guest users. The error message displayed is:
```
This endpoint requires the datasource *, database or all_datasource_access permission
```
Granting `all_datasource_access` does not resolve the issue.
### Root Cause
This issue was introduced after the `<Charts/>` component was refactored. The problem occurs because **the request is sent to the backend without the `dashboardID` in the `form_data` object**.
- In the **previous working implementation**, `dashboardId` was properly set:
[Previous implementation](https://github.com/apache/superset/blob/superset-helm-chart-0.13.4/superset-frontend/src/dashboard/containers/Chart.jsx#L90)
- In the **refactored version**, this logic was removed:
[Refactored `<Charts/>` component](https://github.com/apache/superset/blob/master/superset-frontend/src/dashboard/components/gridComponents/Chart.jsx)
### Fix
This PR restores the missing `dashboardId` by adding the following two lines of code:
```javascript
const dashboardInfo = useSelector(state => state.dashboardInfo);
formData.dashboardId = dashboardInfo.id;
```
Additionally, I have updated **unit tests** to cover this case and ensure proper validation.
### BEFORE/AFTER SCREENSHOTS OR ANIMATED GIF
<!--- Skip this if not applicable -->
#### Before:
<img width="1512" alt="Image" src="https://github.com/user-attachments/assets/11a464e2-7668-4bb8-977d-72c68c75e7ac" />
#### After:
<img width="1506" alt="Image" src="https://github.com/user-attachments/assets/6b485e0e-7b2a-4244-8951-5ae3a5004e67" />
### TESTING INSTRUCTIONS
<!--- Required! What steps can be taken to manually verify the changes? -->
1. Enable embedded mode:
```python
FEATURE_FLAGS = {"EMBEDDED_SUPERSET": True}
GUEST_ROLE_NAME = "Gamma"
```
2. Run Superset with:
```bash
docker compose up --build
```
3. Open a dashboard and enable embedding.
4. Use the dashboard ID in a frontend app (e.g., `@superset-ui/embedded-sdk`).
5. Open the page in a browser.
6. Verify that charts load correctly without a `403` error.
### ADDITIONAL INFORMATION
<!--- Check any relevant boxes with "x" -->
<!--- HINT: Include "Fixes #nnn" if you are fixing an existing issue -->
- [x] Has associated issue:
#32552
#32219
- [x] Required feature flags: `FEATURE_FLAGS = {"EMBEDDED_SUPERSET": True}` is needed
- [x] Changes UI
- [ ] Includes DB Migration (follow approval process in [SIP-59](https://github.com/apache/superset/issues/13351))
- [ ] Migration is atomic, supports rollback & is backwards-compatible
- [ ] Confirm DB migration upgrade and downgrade tested
- [ ] Runtime estimates and downtime expectations provided
- [ ] Introduces new feature or API
- [ ] Removes existing feature or API
--
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: notifications-unsubscribe@superset.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org
Re: [PR] fix(dashboard): Ensure `dashboardId` is included in `form_data` for embedded mode [superset]
Posted by "betodealmeida (via GitHub)" <gi...@apache.org>.
betodealmeida merged PR #32646:
URL: https://github.com/apache/superset/pull/32646
--
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: notifications-unsubscribe@superset.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org
Re: [PR] fix(dashboard): Ensure `dashboardId` is included in `form_data` for embedded mode [superset]
Posted by "imad-hl (via GitHub)" <gi...@apache.org>.
imad-hl commented on PR #32646:
URL: https://github.com/apache/superset/pull/32646#issuecomment-2739823412
Hello,
Great job on fixing this! I wanted to mention that this PR also resolves issue #31938, which I was working on (https://github.com/apache/superset/pull/32289).
--
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: notifications-unsubscribe@superset.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org
Re: [PR] fix(dashboard): Ensure `dashboardId` is included in `form_data` for embedded mode [superset]
Posted by "mistercrunch (via GitHub)" <gi...@apache.org>.
mistercrunch commented on PR #32646:
URL: https://github.com/apache/superset/pull/32646#issuecomment-2722702644
Would be great if you can dig out a reference to the PR that cause the regression and tag the author.
--
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: notifications-unsubscribe@superset.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org