fix: all input text box are disabled (#1855)

Signed-off-by: James <james@jan.ai>
Co-authored-by: James <james@jan.ai>
This commit is contained in:
NamH 2024-01-29 18:53:49 +07:00 committed by GitHub
parent 4237c46fce
commit 1689702dcd
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -66,9 +66,6 @@ const ChatInput: React.FC = () => {
setIsWaitingToSend(false) setIsWaitingToSend(false)
sendChatMessage(currentPrompt) sendChatMessage(currentPrompt)
} }
if (textareaRef.current) {
textareaRef.current.focus()
}
}, [ }, [
activeThreadId, activeThreadId,
isWaitingToSend, isWaitingToSend,
@ -77,11 +74,16 @@ const ChatInput: React.FC = () => {
sendChatMessage, sendChatMessage,
]) ])
useEffect(() => {
if (textareaRef.current) {
textareaRef.current.focus()
}
}, [activeThreadId])
useEffect(() => { useEffect(() => {
if (textareaRef.current) { if (textareaRef.current) {
textareaRef.current.style.height = '40px' textareaRef.current.style.height = '40px'
textareaRef.current.style.height = textareaRef.current.scrollHeight + 'px' textareaRef.current.style.height = textareaRef.current.scrollHeight + 'px'
textareaRef.current.focus()
} }
}, [currentPrompt]) }, [currentPrompt])