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 authored and eschutho committed Jan 13, 2022
1 parent caf0cff commit fbc81d7
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 @@ -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 = {
Expand Down

0 comments on commit fbc81d7

Please sign in to comment.