Search on focus
This commit is contained in:
@ -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);
|
||||
|
||||
Reference in New Issue
Block a user