mirror of
https://github.com/apache/superset.git
synced 2024-09-12 00:29:39 -04:00
fix: fix bug when remove chart not removing it's related cross filter data (#14081)
This commit is contained in:
parent
468638c5b8
commit
d6bd160250
@ -41,6 +41,8 @@ import serializeActiveFilterValues from '../util/serializeActiveFilterValues';
|
||||
import serializeFilterScopes from '../util/serializeFilterScopes';
|
||||
import { getActiveFilters } from '../util/activeDashboardFilters';
|
||||
import { safeStringify } from '../../utils/safeStringify';
|
||||
import { FeatureFlag, isFeatureEnabled } from '../../featureFlags';
|
||||
import { setChartConfiguration } from './dashboardInfo';
|
||||
|
||||
export const SET_UNSAVED_CHANGES = 'SET_UNSAVED_CHANGES';
|
||||
export function setUnsavedChanges(hasUnsavedChanges) {
|
||||
@ -199,6 +201,28 @@ export function saveDashboardRequest(data, id, saveType) {
|
||||
},
|
||||
})
|
||||
.then(response => {
|
||||
if (isFeatureEnabled(FeatureFlag.DASHBOARD_CROSS_FILTERS)) {
|
||||
const {
|
||||
dashboardInfo: {
|
||||
metadata: { chart_configuration = {} },
|
||||
},
|
||||
} = getState();
|
||||
const chartConfiguration = Object.values(chart_configuration).reduce(
|
||||
(prev, next) => {
|
||||
// If chart removed from dashboard - remove it from metadata
|
||||
if (
|
||||
Object.values(layout).find(
|
||||
layoutItem => layoutItem?.meta?.chartId === next.id,
|
||||
)
|
||||
) {
|
||||
return { ...prev, [next.id]: next };
|
||||
}
|
||||
return prev;
|
||||
},
|
||||
{},
|
||||
);
|
||||
dispatch(setChartConfiguration(chartConfiguration));
|
||||
}
|
||||
dispatch(saveDashboardRequestSuccess(response.json.last_modified_time));
|
||||
dispatch(addSuccessToast(t('This dashboard was saved successfully.')));
|
||||
return response;
|
||||
|
Loading…
Reference in New Issue
Block a user