Search on focus
This commit is contained in:
parent
31444756e4
commit
67a61ad3b4
2 changed files with 7 additions and 1 deletions
|
@ -71,6 +71,12 @@ const AutosuggestAccountInput: React.FC<IAutosuggestAccountInput> = ({
|
|||
}
|
||||
};
|
||||
|
||||
useEffect(() => {
|
||||
if (rest.autoFocus) {
|
||||
handleAccountSearch('');
|
||||
}
|
||||
}, []);
|
||||
|
||||
useEffect(() => {
|
||||
if (value === '') {
|
||||
clearResults();
|
||||
|
|
|
@ -31,7 +31,7 @@ const ChatSearch = () => {
|
|||
const { isOpen, changeScreen, toggleChatPane } = useChatContext();
|
||||
const { getOrCreateChatByAccountId } = useChats();
|
||||
|
||||
const [value, setValue] = useState<string>();
|
||||
const [value, setValue] = useState<string>('');
|
||||
const debouncedValue = debounce(value as string, 300);
|
||||
|
||||
const { data: accounts, isFetching } = useAccountSearch(debouncedValue);
|
||||
|
|
Loading…
Reference in a new issue