Skip to content

Commit

Permalink
fix(dashboard): scope status of filter not update in dashboard metada…
Browse files Browse the repository at this point in the history
…ta (#17945)

* fix(dashboard): scope status of filter not update in dashboard metadata

* fix save
  • Loading branch information
stephenLYZ committed Jan 10, 2022
1 parent 7329e3c commit bd9e123
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions superset-frontend/src/dashboard/actions/nativeFilters.ts
Original file line number Diff line number Diff line change
Expand Up @@ -188,6 +188,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 = {
Expand Down

0 comments on commit bd9e123

Please sign in to comment.