michael-s-molina commented on a change in pull request #17018:
URL: https://github.com/apache/superset/pull/17018#discussion_r725029568



##########
File path: 
superset-frontend/src/explore/components/controls/ColorSchemeControl.jsx
##########
@@ -110,23 +110,32 @@ export default class ColorSchemeControl extends 
React.PureComponent {
     // save parsed schemes for later
     this.schemes = isFunction(schemes) ? schemes() : schemes;
 
-    const options = (isFunction(choices) ? choices() : choices).map(
-      ([value]) => ({
-        value,
-        label: this.schemes?.[value]?.label || value,
-        customLabel: this.renderOption(value),
-      }),
+    const supersetDefaultSchemeId = this.schemes?.SUPERSET_DEFAULT?.id;

Review comment:
       ```suggestion
   ```

##########
File path: 
superset-frontend/src/explore/components/controls/ColorSchemeControl.jsx
##########
@@ -110,23 +110,32 @@ export default class ColorSchemeControl extends 
React.PureComponent {
     // save parsed schemes for later
     this.schemes = isFunction(schemes) ? schemes() : schemes;
 
-    const options = (isFunction(choices) ? choices() : choices).map(
-      ([value]) => ({
-        value,
-        label: this.schemes?.[value]?.label || value,
-        customLabel: this.renderOption(value),
-      }),
+    const supersetDefaultSchemeId = this.schemes?.SUPERSET_DEFAULT?.id;
+    const allColorOptions = (isFunction(choices) ? choices() : choices).filter(
+      o => o[0] !== 'SUPERSET_DEFAULT',
     );
+    const options = allColorOptions.map(([value]) => ({
+      value,
+      label: this.schemes?.[value]?.label || value,
+      customLabel: this.renderOption(value),
+    }));
+
+    let currentScheme =
+      this.props.value ||
+      (this.props.default !== undefined ? this.props.default : undefined);
+
+    if (currentScheme === 'SUPERSET_DEFAULT') {
+      currentScheme = supersetDefaultSchemeId;

Review comment:
       ```suggestion
         currentScheme = this.schemes?.SUPERSET_DEFAULT?.id;
   ```




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

To unsubscribe, e-mail: [email protected]

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