Clear user typing text on channel switch

This commit is contained in:
JoramWilander
2016-01-27 11:27:16 -05:00
parent d2a1950d3c
commit e20f78ad0d

View File

@@ -25,9 +25,17 @@ export default class MsgTyping extends React.Component {
SocketStore.addChangeListener(this.onChange);
}
componentWillReceiveProps(newProps) {
if (this.props.channelId !== newProps.channelId) {
this.updateTypingText();
componentWillReceiveProps(nextProps) {
if (this.props.channelId !== nextProps.channelId) {
for (const u in this.typingUsers) {
if (!this.typingUsers.hasOwnProperty(u)) {
continue;
}
clearTimeout(this.typingUsers[u]);
}
this.typingUsers = {};
this.setState({text: ''});
}
}