sadpandajoe commented on code in PR #42483:
URL: https://github.com/apache/superset/pull/42483#discussion_r3829893548


##########
superset-frontend/src/explore/components/controls/DndColumnSelectControl/DndColumnMetricSelect.tsx:
##########
@@ -257,6 +261,25 @@ function DndColumnMetricSelect(props: 
DndColumnMetricSelectProps) {
     [combinedOptionsMap, coercedValue, isMetricSelected],
   );
 
+  const onDropFolder = useCallback(
+    (items: DatasourcePanelDndItem[]) => {
+      // Items already passed `canDrop` (valid, not already selected).
+      const additions: string[] = [];
+      items.forEach(item => {
+        if (item.type === DndItemType.Column) {
+          additions.push((item.value as ColumnMeta).column_name);
+        } else if (item.type === DndItemType.Metric) {
+          additions.push((item.value as Metric).metric_name);
+        }
+      });
+      if (additions.length === 0) {
+        return;
+      }
+      onChange(multi ? [...coercedValue, ...additions] : additions[0]);

Review Comment:
   A folder containing a column and a selected metric with the same name 
appends that bare string twice here: each item is accepted against the pre-drop 
value, and the renderer then treats both entries as the column. Could the 
folder path deduplicate additions (or reapply the selection guard as it builds 
them) before calling `onChange`?



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