alexandrusoare commented on code in PR #33043:
URL: https://github.com/apache/superset/pull/33043#discussion_r2041740142


##########
superset-frontend/src/components/Select/Select.tsx:
##########
@@ -387,6 +488,8 @@ const Select = forwardRef(
         isLoading,
         fullSelectOptions.length,
         helperText,
+        undefined,

Review Comment:
   What is this undefined for?



##########
superset-frontend/src/components/Select/Select.tsx:
##########
@@ -308,37 +310,32 @@ const Select = forwardRef(
 
     const handleOnDeselect: SelectProps['onDeselect'] = (value, option) => {
       if (Array.isArray(selectValue)) {
-        if (getValue(value) === getValue(SELECT_ALL_VALUE)) {
-          clear();
-        } else {
-          let array = selectValue as AntdLabeledValue[];
-          array = array.filter(
-            element => getValue(element) !== getValue(value),
+        let array = selectValue as AntdLabeledValue[];
+        array = array.filter(element => getValue(element) !== getValue(value));

Review Comment:
   Can we avoid the usage of `let` ?



##########
superset-frontend/src/components/Select/Select.tsx:
##########
@@ -308,37 +310,32 @@ const Select = forwardRef(
 
     const handleOnDeselect: SelectProps['onDeselect'] = (value, option) => {
       if (Array.isArray(selectValue)) {
-        if (getValue(value) === getValue(SELECT_ALL_VALUE)) {
-          clear();
-        } else {
-          let array = selectValue as AntdLabeledValue[];
-          array = array.filter(
-            element => getValue(element) !== getValue(value),
+        let array = selectValue as AntdLabeledValue[];
+        array = array.filter(element => getValue(element) !== getValue(value));
+        setSelectValue(array);
+
+        // removes new option
+        if (option.isNewOption) {
+          const updatedOptions = fullSelectOptions.filter(
+            option => getValue(option.value) !== getValue(value),
           );
-          // if this was not a new item, deselect select all option
-          if (selectAllMode && !option.isNewOption) {
-            array = array.filter(
-              element => getValue(element) !== SELECT_ALL_VALUE,
-            );
-          }
-          setSelectValue(array);
-
-          // removes new option
-          if (option.isNewOption) {
-            setSelectOptions(
-              fullSelectOptions.filter(
-                option => getValue(option.value) !== getValue(value),
-              ),
-            );
-          }
+          setSelectOptions(updatedOptions);
+          setVisibleOptions(updatedOptions);
         }
       }
       fireOnChange();
       onDeselect?.(value, option);
     };
 
+    const handleFilterOption = (search: string, option: AntdLabeledValue) =>
+      handleFilterOptionHelper(search, option, optionFilterProps, 
filterOption);
+
     const handleOnSearch = debounce((search: string) => {
       const searchValue = search.trim();
+      setIsSearching(!!searchValue);
+
+      let updatedOptions = selectOptions;
+

Review Comment:
   Here as well



##########
superset-frontend/src/components/Select/Select.tsx:
##########
@@ -469,20 +529,6 @@ const Select = forwardRef(
         let newOptions = options;
         if (!isSingleMode) {

Review Comment:
   Ditto



-- 
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-unsubscr...@superset.apache.org

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


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

Reply via email to