Only call resetInputHistory when there is something to reset

This commit is contained in:
Ken-Håvard Lieng 2017-05-21 23:48:01 +02:00
parent c428842db7
commit 7e080f2c99
2 changed files with 21 additions and 21 deletions

File diff suppressed because one or more lines are too long

View File

@ -7,7 +7,7 @@ export default class MessageInput extends PureComponent {
handleKey = e => {
const { tab, runCommand, sendMessage, addInputHistory, incrementInputHistory,
decrementInputHistory, resetInputHistory } = this.props;
decrementInputHistory, resetInputHistory, history } = this.props;
if (e.key === 'Enter' && e.target.value) {
if (e.target.value[0] === '/') {
@ -24,7 +24,7 @@ export default class MessageInput extends PureComponent {
incrementInputHistory();
} else if (e.key === 'ArrowDown') {
decrementInputHistory();
} else {
} else if (history) {
this.setState({ value: e.target.value });
resetInputHistory();
}