diff --git a/superset-frontend/src/dashboard/actions/dashboardState.js b/superset-frontend/src/dashboard/actions/dashboardState.js index d6c7109a4c098..47ebc8951efa3 100644 --- a/superset-frontend/src/dashboard/actions/dashboardState.js +++ b/superset-frontend/src/dashboard/actions/dashboardState.js @@ -603,11 +603,6 @@ export function setActiveTab(tabId, prevTabId) { return { type: SET_ACTIVE_TAB, tabId, prevTabId }; } -export const SET_ACTIVE_TABS = 'SET_ACTIVE_TABS'; -export function setActiveTabs(activeTabs) { - return { type: SET_ACTIVE_TABS, activeTabs }; -} - export const SET_FOCUSED_FILTER_FIELD = 'SET_FOCUSED_FILTER_FIELD'; export function setFocusedFilterField(chartId, column) { return { type: SET_FOCUSED_FILTER_FIELD, chartId, column }; diff --git a/superset-frontend/src/dashboard/components/DashboardBuilder/DashboardBuilder.tsx b/superset-frontend/src/dashboard/components/DashboardBuilder/DashboardBuilder.tsx index ba21420394b2e..fa6a311e77a7b 100644 --- a/superset-frontend/src/dashboard/components/DashboardBuilder/DashboardBuilder.tsx +++ b/superset-frontend/src/dashboard/components/DashboardBuilder/DashboardBuilder.tsx @@ -412,6 +412,7 @@ const DashboardBuilder: FC = () => { const handleChangeTab = useCallback( ({ pathToTabIndex }: { pathToTabIndex: string[] }) => { dispatch(setDirectPathToChild(pathToTabIndex)); + window.scrollTo(0, 0); }, [dispatch], ); diff --git a/superset-frontend/src/dashboard/reducers/dashboardState.js b/superset-frontend/src/dashboard/reducers/dashboardState.js index 015cb9822c581..ebef4db03570c 100644 --- a/superset-frontend/src/dashboard/reducers/dashboardState.js +++ b/superset-frontend/src/dashboard/reducers/dashboardState.js @@ -38,7 +38,6 @@ import { SET_FOCUSED_FILTER_FIELD, UNSET_FOCUSED_FILTER_FIELD, SET_ACTIVE_TAB, - SET_ACTIVE_TABS, SET_FULL_SIZE_CHART_ID, ON_FILTERS_REFRESH, ON_FILTERS_REFRESH_SUCCESS, @@ -189,12 +188,6 @@ export default function dashboardStateReducer(state = {}, action) { activeTabs: Array.from(newActiveTabs), }; }, - [SET_ACTIVE_TABS]() { - return { - ...state, - activeTabs: action.activeTabs, - }; - }, [SET_OVERRIDE_CONFIRM]() { return { ...state, diff --git a/superset-frontend/src/dashboard/reducers/dashboardState.test.ts b/superset-frontend/src/dashboard/reducers/dashboardState.test.ts index 3a8adc6cbbdc7..378c5978f939a 100644 --- a/superset-frontend/src/dashboard/reducers/dashboardState.test.ts +++ b/superset-frontend/src/dashboard/reducers/dashboardState.test.ts @@ -18,7 +18,7 @@ */ import dashboardStateReducer from './dashboardState'; -import { setActiveTab, setActiveTabs } from '../actions/dashboardState'; +import { setActiveTab } from '../actions/dashboardState'; describe('DashboardState reducer', () => { it('SET_ACTIVE_TAB', () => { @@ -35,16 +35,4 @@ describe('DashboardState reducer', () => { ), ).toEqual({ activeTabs: ['tab2'] }); }); - - it('SET_ACTIVE_TABS', () => { - expect( - dashboardStateReducer({ activeTabs: [] }, setActiveTabs(['tab1'])), - ).toEqual({ activeTabs: ['tab1'] }); - expect( - dashboardStateReducer( - { activeTabs: ['tab1', 'tab2'] }, - setActiveTabs(['tab3', 'tab4']), - ), - ).toEqual({ activeTabs: ['tab3', 'tab4'] }); - }); });