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



##########
File path: superset-frontend/src/dataMask/reducer.ts
##########
@@ -38,24 +38,26 @@ export function getInitialDataMask(id: string): 
DataMaskWithId {
 
 const dataMaskReducer = produce(
   (draft: DataMaskStateWithId, action: AnyDataMaskAction) => {
-    const oldData = { ...draft };
+    const cleanState = {};
+    const oldState = { ...draft };
     switch (action.type) {
       case UPDATE_DATA_MASK:
         draft[action.filterId] = {
           ...draft[action.filterId],
           ...action.dataMask,
           id: action.filterId,
         };
-        break;
+        return draft;
 
       case SET_DATA_MASK_FOR_FILTER_CONFIG_COMPLETE:
         (action.filterConfig ?? []).forEach(filter => {
-          draft[filter.id] =
-            oldData[filter.id] ?? getInitialDataMask(filter.id);
+          cleanState[filter.id] =
+            oldState[filter.id] ?? getInitialDataMask(filter.id);

Review comment:
       Can't we just do `... = draft[filter.id]...` here instead and remove 
`oldState`?




-- 
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