diff options
author | JoramWilander <jwawilander@gmail.com> | 2016-01-27 11:27:16 -0500 |
---|---|---|
committer | JoramWilander <jwawilander@gmail.com> | 2016-01-27 11:27:16 -0500 |
commit | e20f78ad0d20ca7de6acc1150a0d544aebebe9d0 (patch) | |
tree | ba83504dce093f7573f849cf7090ea27702e4ba2 /web/react | |
parent | d2a1950d3c9f074b9b846b471968728a98dd44cf (diff) | |
download | chat-e20f78ad0d20ca7de6acc1150a0d544aebebe9d0.tar.gz chat-e20f78ad0d20ca7de6acc1150a0d544aebebe9d0.tar.bz2 chat-e20f78ad0d20ca7de6acc1150a0d544aebebe9d0.zip |
Clear user typing text on channel switch
Diffstat (limited to 'web/react')
-rw-r--r-- | web/react/components/msg_typing.jsx | 14 |
1 files changed, 11 insertions, 3 deletions
diff --git a/web/react/components/msg_typing.jsx b/web/react/components/msg_typing.jsx index 78b67a216..35a832875 100644 --- a/web/react/components/msg_typing.jsx +++ b/web/react/components/msg_typing.jsx @@ -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: ''}); } } |