diff --git a/web/screens/Chat/ChatInput/index.tsx b/web/screens/Chat/ChatInput/index.tsx index 9293cdc7a..b760ab44c 100644 --- a/web/screens/Chat/ChatInput/index.tsx +++ b/web/screens/Chat/ChatInput/index.tsx @@ -66,9 +66,6 @@ const ChatInput: React.FC = () => { setIsWaitingToSend(false) sendChatMessage(currentPrompt) } - if (textareaRef.current) { - textareaRef.current.focus() - } }, [ activeThreadId, isWaitingToSend, @@ -77,11 +74,16 @@ const ChatInput: React.FC = () => { sendChatMessage, ]) + useEffect(() => { + if (textareaRef.current) { + textareaRef.current.focus() + } + }, [activeThreadId]) + useEffect(() => { if (textareaRef.current) { textareaRef.current.style.height = '40px' textareaRef.current.style.height = textareaRef.current.scrollHeight + 'px' - textareaRef.current.focus() } }, [currentPrompt])