From 9365aa2ceeb64fc798066804d7bcacb5f4294322 Mon Sep 17 00:00:00 2001 From: Alex Gleason Date: Sat, 18 Jun 2022 16:19:22 -0500 Subject: [PATCH] ChatWindow: don't focus on setting ref --- app/soapbox/features/chats/components/chat-window.tsx | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/app/soapbox/features/chats/components/chat-window.tsx b/app/soapbox/features/chats/components/chat-window.tsx index 356669917..5a71f6598 100644 --- a/app/soapbox/features/chats/components/chat-window.tsx +++ b/app/soapbox/features/chats/components/chat-window.tsx @@ -58,7 +58,6 @@ const ChatWindow: React.FC = ({ idx, chatId, windowState }) => { const handleInputRef = (el: HTMLTextAreaElement) => { inputElem.current = el; - focusInput(); }; const focusInput = () => { @@ -66,8 +65,10 @@ const ChatWindow: React.FC = ({ idx, chatId, windowState }) => { }; useEffect(() => { - focusInput(); - }, [windowState === 'open']); + if (windowState === 'open') { + focusInput(); + } + }, [windowState]); if (!chat) return null; const account = chat.account as unknown as AccountEntity;