fix(react): do not submit empty message

This commit is contained in:
Pavel Prichodko 2022-06-20 23:44:51 +02:00
parent e186ec7e79
commit e338c67592
No known key found for this signature in database
GPG Key ID: 8E4C82D464215E83
1 changed files with 4 additions and 0 deletions

View File

@ -34,6 +34,10 @@ export const ChatInput = (props: Props) => {
} }
const handleKeyDown = (event: React.KeyboardEvent<HTMLInputElement>) => { const handleKeyDown = (event: React.KeyboardEvent<HTMLInputElement>) => {
if (inputValue === '') {
return
}
if (event.key === 'Enter' && event.shiftKey === false) { if (event.key === 'Enter' && event.shiftKey === false) {
onSubmit(inputValue) onSubmit(inputValue)
setInputValue('') setInputValue('')