From fbc81d7883a3d53e9b91196cd981ff9bcca3dd29 Mon Sep 17 00:00:00 2001 From: Stephen Liu <750188453@qq.com> Date: Tue, 11 Jan 2022 01:19:25 +0800 Subject: [PATCH] fix(dashboard): scope status of filter not update in dashboard metadata (#17945) * fix(dashboard): scope status of filter not update in dashboard metadata * fix save --- .../src/dashboard/actions/nativeFilters.ts | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/superset-frontend/src/dashboard/actions/nativeFilters.ts b/superset-frontend/src/dashboard/actions/nativeFilters.ts index 150b8857ae6e5..e56d6bb3dcd7d 100644 --- a/superset-frontend/src/dashboard/actions/nativeFilters.ts +++ b/superset-frontend/src/dashboard/actions/nativeFilters.ts @@ -146,6 +146,25 @@ export const setInScopeStatusOfFilters = ( type: SET_IN_SCOPE_STATUS_OF_FILTERS, filterConfig: filtersWithScopes, }); + // need to update native_filter_configuration in the dashboard metadata + const { metadata } = getState().dashboardInfo; + const filterConfig: FilterConfiguration = + metadata.native_filter_configuration; + const mergedFilterConfig = filterConfig.map(filter => { + const filterWithScope = filtersWithScopes.find( + scope => scope.id === filter.id, + ); + if (!filterWithScope) { + return filter; + } + return { ...filterWithScope, ...filter }; + }); + metadata.native_filter_configuration = mergedFilterConfig; + dispatch( + dashboardInfoChanged({ + metadata, + }), + ); }; type BootstrapData = {