villebro commented on a change in pull request #13983:
URL: https://github.com/apache/superset/pull/13983#discussion_r611380286



##########
File path: superset-frontend/src/dashboard/actions/dashboardState.js
##########
@@ -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));
+        }

Review comment:
       I assume this isn't strictly related to this PR? As this is a pretty 
heavy PR, could we break this out into a separate PR? (trying to avoid 
unnecessary bycatches)

##########
File path: superset-frontend/src/dataMask/types.ts
##########
@@ -16,29 +16,14 @@
  * specific language governing permissions and limitations
  * under the License.
  */
-import { ExtraFormData, DataMaskCurrentState } from '@superset-ui/core';
+import { DataMask } from '@superset-ui/core';
 
 export enum DataMaskType {
   NativeFilters = 'nativeFilters',
   CrossFilters = 'crossFilters',
-  OwnFilters = 'ownFilters',
 }
 
-export type Mask = {
-  extraFormData?: ExtraFormData;
-  currentState: DataMaskCurrentState;
-};
-export type DataMaskUnit = { [filterId: string]: Mask };
-export type DataMaskState = {
-  [DataMaskType.NativeFilters]: Mask;
-  [DataMaskType.CrossFilters]: Mask;
-  [DataMaskType.OwnFilters]: Mask;
-};
+export type DataMaskState = { [id: string]: DataMask };
 
-export type MaskWithId = Mask & { id: string };
-export type DataMaskUnitWithId = { [filterId: string]: MaskWithId };
-export type DataMaskStateWithId = {
-  [DataMaskType.NativeFilters]: DataMaskUnitWithId;
-  [DataMaskType.CrossFilters]: DataMaskUnitWithId;
-  [DataMaskType.OwnFilters]: DataMaskUnitWithId;
-};
+export type DataMaskWithId = DataMask & { id: string };
+export type DataMaskStateWithId = { [filterId: string]: DataMaskWithId };

Review comment:
       Much better!




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
[email protected]



---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to