ktmud commented on a change in pull request #10814:
URL: 
https://github.com/apache/incubator-superset/pull/10814#discussion_r485274945



##########
File path: 
superset-frontend/src/explore/components/controls/ColorSchemeControl.jsx
##########
@@ -100,12 +98,16 @@ export default class ColorSchemeControl extends 
React.PureComponent {
   }
 
   render() {
-    const { choices } = this.props;
-    const options = (isFunction(choices) ? choices() : choices).map(choice => 
({
-      value: choice[0],
-      label: choice[1],
-    }));
-
+    const { schemes, choices } = this.props;
+    // save parsed schemes for later
+    this.schemes = isFunction(schemes) ? schemes() : schemes;
+    const options = (isFunction(choices) ? choices() : choices).map(
+      ([value, label]) => ({
+        value,
+        // use scheme label if available
+        label: this.schemes[value]?.label || label,

Review comment:
       Pre-compute and pass scheme labels to `options` so that we can search by 
labels. E.g. (without this change, searching "airbnb" will return no 
results---because the "Airbnb Colors" scheme has a value of "bnbColors").




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