From 5d65d4d95e2e8d911d09cfed05db18ad01937fdc Mon Sep 17 00:00:00 2001 From: Pavel Prichodko <14926950+prichodko@users.noreply.github.com> Date: Mon, 20 Jun 2022 23:44:51 +0200 Subject: [PATCH] fix(react): do not submit empty message --- .../src/routes/chat/components/chat-input/index.tsx | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/packages/status-react/src/routes/chat/components/chat-input/index.tsx b/packages/status-react/src/routes/chat/components/chat-input/index.tsx index a2c788ff..92bcd7d7 100644 --- a/packages/status-react/src/routes/chat/components/chat-input/index.tsx +++ b/packages/status-react/src/routes/chat/components/chat-input/index.tsx @@ -34,6 +34,10 @@ export const ChatInput = (props: Props) => { } const handleKeyDown = (event: React.KeyboardEvent) => { + if (inputValue === '') { + return + } + if (event.key === 'Enter' && event.shiftKey === false) { onSubmit(inputValue) setInputValue('')