fix: Removes Redux state mutations - iteration 1 (#23522)

This commit is contained in:
Michael S. Molina
2023-03-31 14:19:02 -03:00
committed by GitHub
parent ee9ef24509
commit 1ced7cdbbb
3 changed files with 14 additions and 10 deletions

View File

@@ -18,6 +18,7 @@
*/
/* eslint camelcase: 0 */
import { t } from '@superset-ui/core';
import { omit } from 'lodash';
import { HYDRATE_DASHBOARD } from 'src/dashboard/actions/hydrate';
import { DatasourcesAction } from 'src/dashboard/actions/datasources';
import { ChartState } from 'src/explore/types';
@@ -180,8 +181,7 @@ export default function chartReducer(
/* eslint-disable no-param-reassign */
if (action.type === actions.REMOVE_CHART) {
delete charts[action.key];
return charts;
return omit(charts, [action.key]);
}
if (action.type === actions.UPDATE_CHART_ID) {
const { newId, key } = action;