ChatWindow: don't focus on setting ref

This commit is contained in:
Alex Gleason 2022-06-18 16:19:22 -05:00
parent 9f0b7db8d8
commit 9365aa2cee
No known key found for this signature in database
GPG Key ID: 7211D1F99744FBB7
1 changed files with 4 additions and 3 deletions

View File

@ -58,7 +58,6 @@ const ChatWindow: React.FC<IChatWindow> = ({ idx, chatId, windowState }) => {
const handleInputRef = (el: HTMLTextAreaElement) => {
inputElem.current = el;
focusInput();
};
const focusInput = () => {
@ -66,8 +65,10 @@ const ChatWindow: React.FC<IChatWindow> = ({ idx, chatId, windowState }) => {
};
useEffect(() => {
focusInput();
}, [windowState === 'open']);
if (windowState === 'open') {
focusInput();
}
}, [windowState]);
if (!chat) return null;
const account = chat.account as unknown as AccountEntity;