This is an automated email from the ASF dual-hosted git repository.

diegopucci pushed a commit to branch chore/color-scheme-updates
in repository https://gitbox.apache.org/repos/asf/superset.git

commit 2f9988b828e05b5a70ea4c52c78eb41269640658
Author: geido <[email protected]>
AuthorDate: Thu Jun 30 15:51:16 2022 +0300

    Fix hydrate action
---
 .../src/explore/actions/hydrateExplore.ts          | 23 ++++------------------
 1 file changed, 4 insertions(+), 19 deletions(-)

diff --git a/superset-frontend/src/explore/actions/hydrateExplore.ts 
b/superset-frontend/src/explore/actions/hydrateExplore.ts
index 0c7491d161..454f1449d8 100644
--- a/superset-frontend/src/explore/actions/hydrateExplore.ts
+++ b/superset-frontend/src/explore/actions/hydrateExplore.ts
@@ -70,14 +70,12 @@ export const hydrateExplore =
     const colorSchemeKey = initialControls['color_scheme'] && 'color_scheme';
     const linearColorSchemeKey = initialControls['linear_color_scheme'] && 
'linear_color_scheme';
     // verifies whether the current color scheme exists in the registry
-    // if not fallbacks to the default
+    // if not fallbacks to the default color scheme key
     const verifyColorScheme = (type: 'CATEGORICAL' | 'SEQUENTIAL') => {
       const schemes = type === 'CATEGORICAL' ? getCategoricalSchemeRegistry() 
: getSequentialSchemeRegistry();
       const key = type === 'CATEGORICAL' ? colorSchemeKey : 
linearColorSchemeKey;
-      if (!schemes.items[initialFormData[key]]) {
-        Object.assign(initialFormData, {
-          color_scheme: schemes.defaultKey,
-        })
+      const currentScheme = initialFormData[key];
+      if (currentScheme && !schemes.items[currentScheme]) {
         initialControls[key].value = schemes.defaultKey
       }
     }
@@ -153,20 +151,7 @@ export const hydrateExplore =
           dashboards: [],
           saveModalAlert: null,
         },
-        explore: {
-          ...exploreState,
-          form_data: {
-            ...exploreState.form_data,
-            color_scheme: 'bnbColors',
-          },
-          slice: {
-            ...exploreState.slice,
-            form_data: {
-              ...exploreState.slice.form_data,
-              color_scheme: 'bnbColors',
-            }
-          }
-        },
+        explore: exploreState,
       },
     });
   };

Reply via email to