Search on focus

This commit is contained in:
Chewbacca 2022-12-01 12:40:30 -05:00
parent 31444756e4
commit 67a61ad3b4
2 changed files with 7 additions and 1 deletions

View file

@ -71,6 +71,12 @@ const AutosuggestAccountInput: React.FC<IAutosuggestAccountInput> = ({
}
};
useEffect(() => {
if (rest.autoFocus) {
handleAccountSearch('');
}
}, []);
useEffect(() => {
if (value === '') {
clearResults();

View file

@ -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);