You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@superset.apache.org by GitBox <gi...@apache.org> on 2021/08/26 18:41:23 UTC

[GitHub] [superset] michellethomas commented on a change in pull request #16362: refactor(explore): improve typing for Dnd controls

michellethomas commented on a change in pull request #16362:
URL: https://github.com/apache/superset/pull/16362#discussion_r696888750



##########
File path: superset-frontend/src/explore/components/controls/DndColumnSelectControl/DndMetricSelect.tsx
##########
@@ -176,7 +186,9 @@ export const DndMetricSelect = (props: any) => {
 
   const onNewMetric = useCallback(
     (newMetric: Metric) => {
-      const newValue = props.multi ? [...value, newMetric] : [newMetric];
+      const newValue = props.multi
+        ? [...value, newMetric.metric_name]
+        : [newMetric.metric_name];

Review comment:
       @ktmud I believe this introduced a bug with dragging columns into the metrics section and creating a `SIMPLE` expression for the column. When you drag a column into the metrics section the data looks like the data listed below and does not have a metric_name. This leads to an undefined option being returned and later errors:
   ```
   aggregate: "COUNT_DISTINCT"
   column: {column_name: "target"}
   expressionType: "SIMPLE"
   hasCustomLabel: false
   isNew: false
   label: "COUNT_DISTINCT(target)"
   optionName: "metric_1vo4t2m2tjl_0nhrga77x9pf"
   sqlExpression: null
   ```




-- 
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: notifications-unsubscribe@superset.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org