From 1689702dcdda534612be432b11f4b53dc19fbb12 Mon Sep 17 00:00:00 2001 From: NamH Date: Mon, 29 Jan 2024 18:53:49 +0700 Subject: [PATCH] fix: all input text box are disabled (#1855) Signed-off-by: James Co-authored-by: James --- web/screens/Chat/ChatInput/index.tsx | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) 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])