Fix the app window pops up second to foreground when a new message is received

This commit is contained in:
Yuya Ochiai
2016-09-29 23:25:22 +09:00
parent 13678811c3
commit 55ccaf33cd
2 changed files with 15 additions and 2 deletions

View File

@@ -113,8 +113,10 @@ var MainPage = React.createClass({
}
});
},
componentDidUpdate: function() {
this.refs[`mattermostView${this.state.key}`].focusOnWebView();
componentDidUpdate: function(prevProps, prevState) {
if (prevState.key !== this.state.key) { // i.e. When tab has been changed
this.refs[`mattermostView${this.state.key}`].focusOnWebView();
}
},
handleSelect: function(key) {
const newKey = (this.props.teams.length + key) % this.props.teams.length;