williaster commented on a change in pull request #4736: [Explore] Adding custom 
expressions to adhoc metrics
URL: 
https://github.com/apache/incubator-superset/pull/4736#discussion_r180897336
 
 

 ##########
 File path: 
superset/assets/javascripts/explore/components/AdhocMetricEditPopover.jsx
 ##########
 @@ -48,16 +83,25 @@ export default class AdhocMetricEditPopover extends 
React.Component {
   }
 
   onColumnChange(column) {
-    this.setState({ adhocMetric: this.state.adhocMetric.duplicateWith({ column 
}) });
+    this.setState({ adhocMetric: this.state.adhocMetric.duplicateWith({
+      column,
+      expressionType: EXPRESSION_TYPES.SIMPLE,
+    }) });
   }
 
   onAggregateChange(aggregate) {
     // we construct this object explicitly to overwrite the value in the case 
aggregate is null
-    this.setState({
-      adhocMetric: this.state.adhocMetric.duplicateWith({
-        aggregate: aggregate && aggregate.aggregate,
-      }),
-    });
+    this.setState({ adhocMetric: this.state.adhocMetric.duplicateWith({
 
 Review comment:
   nit -- I would newline `adhocMetric`, wish we had better lint rules enabled! 
🙉  

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services

Reply via email to