You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@superset.apache.org by ru...@apache.org on 2026/06/02 16:05:14 UTC
(superset) branch fix/hide-edit-button-embedded-dashboard created (now 8d13ce27a0c)
This is an automated email from the ASF dual-hosted git repository.
rusackas pushed a change to branch fix/hide-edit-button-embedded-dashboard
in repository https://gitbox.apache.org/repos/asf/superset.git
at 8d13ce27a0c fix(dashboard): hide Edit button in embedded dashboards
This branch includes the following new commits:
new 8d13ce27a0c fix(dashboard): hide Edit button in embedded dashboards
The 1 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails. The revisions
listed as "add" were already present in the repository and have only
been added to this reference.
(superset) 01/01: fix(dashboard): hide Edit button in embedded dashboards
Posted by ru...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
rusackas pushed a commit to branch fix/hide-edit-button-embedded-dashboard
in repository https://gitbox.apache.org/repos/asf/superset.git
commit 8d13ce27a0cd0850d0b17aca94c9613770c98c2b
Author: Claude Code <no...@anthropic.com>
AuthorDate: Tue Jun 2 09:05:01 2026 -0700
fix(dashboard): hide Edit button in embedded dashboards
Embedded (Embedded SDK) dashboards authenticate with a guest token and have no
userId, so the header already derives `isEmbedded = !dashboardInfo?.userId`.
The Edit button was gated only on `userCanEdit`, so it appeared in embedded
dashboards; entering edit mode there and discarding leaves the iframe stuck on
a perpetual loading screen (#30893). Gate the button on `!isEmbedded` as well.
Co-Authored-By: Claude Opus 4.8 <no...@anthropic.com>
---
.../src/dashboard/components/Header/Header.test.tsx | 15 +++++++++++++++
.../src/dashboard/components/Header/index.tsx | 3 ++-
2 files changed, 17 insertions(+), 1 deletion(-)
diff --git a/superset-frontend/src/dashboard/components/Header/Header.test.tsx b/superset-frontend/src/dashboard/components/Header/Header.test.tsx
index ac331442021..d6890cbf3e7 100644
--- a/superset-frontend/src/dashboard/components/Header/Header.test.tsx
+++ b/superset-frontend/src/dashboard/components/Header/Header.test.tsx
@@ -611,6 +611,21 @@ test('should toggle the edit mode', () => {
expect(logEvent).toHaveBeenCalled();
});
+test('should NOT render the Edit dashboard button when embedded', () => {
+ // Embedded (Embedded SDK) dashboards authenticate with a guest token and so
+ // have no userId. The Edit button must be hidden even with edit permission,
+ // since the embedded context cannot handle entering/exiting edit mode.
+ const embeddedCanEditState = {
+ dashboardInfo: {
+ ...initialState.dashboardInfo,
+ dash_edit_perm: true,
+ userId: undefined,
+ },
+ };
+ setup(embeddedCanEditState);
+ expect(screen.queryByTestId('edit-dashboard-button')).not.toBeInTheDocument();
+});
+
test('should render the dropdown icon', () => {
setup();
expect(screen.getByRole('img', { name: 'ellipsis' })).toBeInTheDocument();
diff --git a/superset-frontend/src/dashboard/components/Header/index.tsx b/superset-frontend/src/dashboard/components/Header/index.tsx
index 522a22f1eca..5eced8188e6 100644
--- a/superset-frontend/src/dashboard/components/Header/index.tsx
+++ b/superset-frontend/src/dashboard/components/Header/index.tsx
@@ -749,7 +749,7 @@ const Header = (): JSX.Element => {
) : (
<div css={actionButtonsStyle}>
{NavExtension && <NavExtension />}
- {userCanEdit && (
+ {userCanEdit && !isEmbedded && (
<Button
buttonStyle="secondary"
onClick={handleEnterEditMode}
@@ -776,6 +776,7 @@ const Header = (): JSX.Element => {
handleCtrlZ,
handleEnterEditMode,
hasUnsavedChanges,
+ isEmbedded,
overwriteDashboard,
redoLength,
undoLength,