From 961766e83393826087e8f187e0e1a5f45a750b86 Mon Sep 17 00:00:00 2001 From: Ville Brofeldt <33317356+villebro@users.noreply.github.com> Date: Thu, 16 Dec 2021 11:27:46 +0200 Subject: [PATCH] fix(filter-sets): 404 on dashboard load (#17777) --- superset-frontend/src/dashboard/actions/nativeFilters.ts | 9 ++++----- .../src/dashboard/containers/DashboardPage.tsx | 2 +- 2 files changed, 5 insertions(+), 6 deletions(-) diff --git a/superset-frontend/src/dashboard/actions/nativeFilters.ts b/superset-frontend/src/dashboard/actions/nativeFilters.ts index 65d655db6db49..359adb87ea59c 100644 --- a/superset-frontend/src/dashboard/actions/nativeFilters.ts +++ b/superset-frontend/src/dashboard/actions/nativeFilters.ts @@ -204,8 +204,7 @@ export interface SetBootstrapData { } export const getFilterSets = - () => async (dispatch: Dispatch, getState: () => RootState) => { - const dashboardId = getState().dashboardInfo.id; + (dashboardId: number) => async (dispatch: Dispatch) => { const fetchFilterSets = makeApi< null, { @@ -271,7 +270,7 @@ export const createFilterSet = dispatch({ type: CREATE_FILTER_SET_COMPLETE, }); - dispatch(getFilterSets()); + dispatch(getFilterSets(dashboardId)); }; export const updateFilterSet = @@ -308,7 +307,7 @@ export const updateFilterSet = dispatch({ type: UPDATE_FILTER_SET_COMPLETE, }); - dispatch(getFilterSets()); + dispatch(getFilterSets(dashboardId)); }; export const deleteFilterSet = @@ -329,7 +328,7 @@ export const deleteFilterSet = dispatch({ type: DELETE_FILTER_SET_COMPLETE, }); - dispatch(getFilterSets()); + dispatch(getFilterSets(dashboardId)); }; export const SET_FOCUSED_NATIVE_FILTER = 'SET_FOCUSED_NATIVE_FILTER'; diff --git a/superset-frontend/src/dashboard/containers/DashboardPage.tsx b/superset-frontend/src/dashboard/containers/DashboardPage.tsx index 35968886b8453..20e98a598f71a 100644 --- a/superset-frontend/src/dashboard/containers/DashboardPage.tsx +++ b/superset-frontend/src/dashboard/containers/DashboardPage.tsx @@ -158,7 +158,7 @@ const DashboardPage: FC = () => { isDashboardHydrated.current = true; if (isFeatureEnabled(FeatureFlag.DASHBOARD_NATIVE_FILTERS_SET)) { // only initialize filterset once - dispatch(getFilterSets()); + dispatch(getFilterSets(id)); } } dispatch(hydrateDashboard(dashboard, charts, filterboxMigrationState));