diff --git a/superset-frontend/src/dashboard/actions/dashboardLayout.js b/superset-frontend/src/dashboard/actions/dashboardLayout.js index 8d4b3fa56..b771ae202 100644 --- a/superset-frontend/src/dashboard/actions/dashboardLayout.js +++ b/superset-frontend/src/dashboard/actions/dashboardLayout.js @@ -267,6 +267,8 @@ export function handleComponentDrop(dropResult) { }; } +export const clearDashboardHistory = () => UndoActionCreators.clearHistory(); + // Undo redo ------------------------------------------------------------------ export function undoLayoutAction() { return (dispatch, getState) => { diff --git a/superset-frontend/src/dashboard/components/DashboardBuilder/DashboardBuilder.tsx b/superset-frontend/src/dashboard/components/DashboardBuilder/DashboardBuilder.tsx index 8ab46e7ca..29dc12a7c 100644 --- a/superset-frontend/src/dashboard/components/DashboardBuilder/DashboardBuilder.tsx +++ b/superset-frontend/src/dashboard/components/DashboardBuilder/DashboardBuilder.tsx @@ -55,6 +55,7 @@ import { import { deleteTopLevelTabs, handleComponentDrop, + clearDashboardHistory, } from 'src/dashboard/actions/dashboardLayout'; import { DASHBOARD_GRID_ID, @@ -675,7 +676,10 @@ const DashboardBuilder = () => { ) } buttonText={canEdit && t('Edit the dashboard')} - buttonAction={() => dispatch(setEditMode(true))} + buttonAction={() => { + dispatch(setEditMode(true)); + dispatch(clearDashboardHistory()); + }} image="dashboard.svg" /> )} diff --git a/superset-frontend/src/dashboard/components/Header/index.jsx b/superset-frontend/src/dashboard/components/Header/index.jsx index f77c680e2..5ce86cc52 100644 --- a/superset-frontend/src/dashboard/components/Header/index.jsx +++ b/superset-frontend/src/dashboard/components/Header/index.jsx @@ -66,6 +66,7 @@ import { redoLayoutAction, undoLayoutAction, updateDashboardTitle, + clearDashboardHistory, } from '../../actions/dashboardLayout'; import { fetchCharts, @@ -221,6 +222,7 @@ const Header = () => { addWarningToast, onUndo: undoLayoutAction, onRedo: redoLayoutAction, + clearDashboardHistory, setEditMode, setUnsavedChanges, fetchFaveStar, @@ -651,7 +653,10 @@ const Header = () => { {userCanEdit && (