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 2022/03/02 13:03:10 UTC

[GitHub] [superset] michael-s-molina commented on a change in pull request #18799: feat: remove loading indicator when typing in select

michael-s-molina commented on a change in pull request #18799:
URL: https://github.com/apache/superset/pull/18799#discussion_r817635382



##########
File path: superset-frontend/src/components/Select/Select.tsx
##########
@@ -510,40 +504,55 @@ const Select = ({
         .catch(internalOnError)
         .finally(() => {
           setIsLoading(false);
-          setIsTyping(false);
         });
     },
-    [allValuesLoaded, fetchOnlyOnSearch, handleData, internalOnError, options],
+    [
+      allValuesLoaded,
+      fetchOnlyOnSearch,
+      handleData,
+      internalOnError,
+      options,
+      pageSize,
+    ],
   );
 
-  const handleOnSearch = useMemo(
+  const debouncedHandleSearch = useMemo(
     () =>
       debounce((search: string) => {
-        const searchValue = search.trim();
-        if (allowNewOptions && isSingleMode) {
-          const newOption = searchValue &&
-            !hasOption(searchValue, selectOptions) && {
-              label: searchValue,
-              value: searchValue,
-            };
-          const newOptions = newOption
-            ? [
-                newOption,
-                ...selectOptions.filter(opt => opt.value !== searchedValue),
-              ]
-            : [...selectOptions.filter(opt => opt.value !== searchedValue)];
-
-          setSelectOptions(newOptions);
-        }
-
-        if (!searchValue || searchValue === searchedValue) {
-          setIsTyping(false);
-        }
-        setSearchedValue(searchValue);
-      }, DEBOUNCE_TIMEOUT),
-    [allowNewOptions, isSingleMode, searchedValue, selectOptions],
+        // async search will triggered in handlePaginatedFetch

Review comment:
       ```suggestion
           // async search will be triggered in handlePaginatedFetch
   ```

##########
File path: superset-frontend/src/components/Select/Select.tsx
##########
@@ -57,18 +57,12 @@ type PickedSelectProps = Pick<
   | 'notFoundContent'
   | 'onChange'
   | 'onClear'
-  | 'onFocus'

Review comment:
       Why did you remove the `onFocus` prop? It's being used by `SelectControl`.




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