fix(chat): prevent empty messages

This commit is contained in:
Leonard Kim 2019-03-08 09:08:55 -08:00 committed by Saúl Ibarra Corretgé
parent c737d46d90
commit 81d4f694b7
1 changed files with 6 additions and 2 deletions

View File

@ -157,9 +157,13 @@ class ChatInput extends Component<Props, State> {
&& event.shiftKey === false) {
event.preventDefault();
this.props.dispatch(sendMessage(this.state.message));
const trimmed = this.state.message.trim();
this.setState({ message: '' });
if (trimmed) {
this.props.dispatch(sendMessage(trimmed));
this.setState({ message: '' });
}
}
}