geido commented on a change in pull request #17379:
URL: https://github.com/apache/superset/pull/17379#discussion_r748425157



##########
File path: 
superset-frontend/src/explore/components/controls/DndColumnSelectControl/ColumnSelectPopover.tsx
##########
@@ -41,29 +53,48 @@ const StyledSelect = styled(Select)`
 
 interface ColumnSelectPopoverProps {
   columns: ColumnMeta[];
-  editedColumn?: ColumnMeta;
-  onChange: (column: ColumnMeta) => void;
+  editedColumn?: ColumnMeta | AdhocColumn;
+  onChange: (column: ColumnMeta | AdhocColumn) => void;
   onClose: () => void;
+  setLabel: (title: string) => void;
+  getCurrentTab: (tab: string) => void;
+  label: string;
+  isAdhocColumnsEnabled: boolean;
 }
 
 const ColumnSelectPopover = ({
   columns,
   editedColumn,
   onChange,
   onClose,
+  setLabel,
+  getCurrentTab,
+  label,
+  isAdhocColumnsEnabled,
 }: ColumnSelectPopoverProps) => {
-  const [
-    initialCalculatedColumn,
-    initialSimpleColumn,
-  ] = editedColumn?.expression
-    ? [editedColumn, undefined]
-    : [undefined, editedColumn];
-  const [selectedCalculatedColumn, setSelectedCalculatedColumn] = useState(
-    initialCalculatedColumn,
-  );
-  const [selectedSimpleColumn, setSelectedSimpleColumn] = useState(
-    initialSimpleColumn,
+  const [initialLabel] = useState(label);
+  const [initialAdhocColumn, initialCalculatedColumn, initialSimpleColumn]: [
+    AdhocColumn?,
+    ColumnMeta?,
+    ColumnMeta?,
+  ] = !editedColumn
+    ? [undefined, undefined, undefined]

Review comment:
       I appreciate the brevity but this is probably one of those instances 
where brevity goes against readability. I would prefer to see all these logics 
below unpacked but that's a personal preference and not a blocker.




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