This is an automated email from the ASF dual-hosted git repository.

michaelsmolina pushed a commit to branch 4.0
in repository https://gitbox.apache.org/repos/asf/superset.git

commit 0c6fdc55606e2c68decbf087d13470542440b8a7
Author: Michael S. Molina <[email protected]>
AuthorDate: Wed May 8 15:54:00 2024 -0300

    fix: Scroll to top when selecting a global dashboard tab (#28386)
    
    (cherry picked from commit 9e4ba6762f1a9e89102fd75c0560ffefe92cb723)
---
 superset-frontend/src/dashboard/actions/dashboardState.js  |  5 -----
 .../components/DashboardBuilder/DashboardBuilder.tsx       |  1 +
 superset-frontend/src/dashboard/reducers/dashboardState.js |  7 -------
 .../src/dashboard/reducers/dashboardState.test.ts          | 14 +-------------
 4 files changed, 2 insertions(+), 25 deletions(-)

diff --git a/superset-frontend/src/dashboard/actions/dashboardState.js 
b/superset-frontend/src/dashboard/actions/dashboardState.js
index bdbf430903..a086a85c16 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 ba21420394..fa6a311e77 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<DashboardBuilderProps> = () => {
   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 015cb9822c..ebef4db035 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 3a8adc6cbb..378c5978f9 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'] });
-  });
 });

Reply via email to