Skip to content

Commit

Permalink
fix: cleared input debounce on search chip input to avoid race condit…
Browse files Browse the repository at this point in the history
…ions
  • Loading branch information
nubsthead committed Feb 11, 2022
1 parent 6203724 commit 4a9de94
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/search/search-bar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -295,6 +295,7 @@ export const SearchBar: FC<SearchBarProps> = ({ currentApp, primaryAction, secon
},
[query, updateOptions, isTyping]
);

useEffect(() => {
if (moduleSelection?.value) {
const suggestions = filter(
Expand Down Expand Up @@ -339,7 +340,7 @@ export const SearchBar: FC<SearchBarProps> = ({ currentApp, primaryAction, secon
const ref = inputRef.current;
const searchCb = (ev: any): void => {
if (ev.key === 'Enter') {
setTriggerSearch(true);
setTimeout(() => setTriggerSearch(true), 0);
}
};
if (ref) {
Expand All @@ -351,6 +352,7 @@ export const SearchBar: FC<SearchBarProps> = ({ currentApp, primaryAction, secon
}
};
}, [onSearch]);

useEffect(() => {
if (triggerSearch) {
onSearch();
Expand Down Expand Up @@ -477,6 +479,7 @@ export const SearchBar: FC<SearchBarProps> = ({ currentApp, primaryAction, secon
}}
onChange={onQueryChange}
onInputType={onInputType}
onInputTypeDebounce={0}
onBlur={removeFocus}
onFocus={addFocus}
disableOptions={disableOptions}
Expand Down

0 comments on commit 4a9de94

Please sign in to comment.