Fix state updating in ChatTitle and UserList
This commit is contained in:
parent
d4d51778fb
commit
77c723344c
|
@ -11,7 +11,7 @@ var privateChatActions = require('../actions/privateChat');
|
||||||
var ChatTitle = React.createClass({
|
var ChatTitle = React.createClass({
|
||||||
mixins: [
|
mixins: [
|
||||||
Reflux.listenTo(channelStore, 'channelsChanged'),
|
Reflux.listenTo(channelStore, 'channelsChanged'),
|
||||||
Reflux.connect(selectedTabStore, 'selectedTab')
|
Reflux.listenTo(selectedTabStore, 'selectedTabChanged')
|
||||||
],
|
],
|
||||||
|
|
||||||
getInitialState: function() {
|
getInitialState: function() {
|
||||||
|
@ -29,6 +29,13 @@ var ChatTitle = React.createClass({
|
||||||
this.setState({ usercount: channelStore.getUsers(tab.server, tab.channel).length });
|
this.setState({ usercount: channelStore.getUsers(tab.server, tab.channel).length });
|
||||||
},
|
},
|
||||||
|
|
||||||
|
selectedTabChanged: function(tab) {
|
||||||
|
this.setState({
|
||||||
|
selectedTab: tab,
|
||||||
|
usercount: channelStore.getUsers(tab.server, tab.channel).length
|
||||||
|
});
|
||||||
|
},
|
||||||
|
|
||||||
handleLeaveClick: function() {
|
handleLeaveClick: function() {
|
||||||
var tab = this.state.selectedTab;
|
var tab = this.state.selectedTab;
|
||||||
|
|
||||||
|
|
|
@ -10,7 +10,7 @@ var selectedTabStore = require('../stores/selectedTab');
|
||||||
var UserList = React.createClass({
|
var UserList = React.createClass({
|
||||||
mixins: [
|
mixins: [
|
||||||
Reflux.listenTo(channelStore, 'channelsChanged'),
|
Reflux.listenTo(channelStore, 'channelsChanged'),
|
||||||
Reflux.connect(selectedTabStore, 'selectedTab')
|
Reflux.listenTo(selectedTabStore, 'selectedTabChanged')
|
||||||
],
|
],
|
||||||
|
|
||||||
getInitialState: function() {
|
getInitialState: function() {
|
||||||
|
@ -37,6 +37,13 @@ var UserList = React.createClass({
|
||||||
this.setState({ users: channelStore.getUsers(tab.server, tab.channel) });
|
this.setState({ users: channelStore.getUsers(tab.server, tab.channel) });
|
||||||
},
|
},
|
||||||
|
|
||||||
|
selectedTabChanged: function(tab) {
|
||||||
|
this.setState({
|
||||||
|
selectedTab: tab,
|
||||||
|
users: channelStore.getUsers(tab.server, tab.channel)
|
||||||
|
});
|
||||||
|
},
|
||||||
|
|
||||||
handleResize: function() {
|
handleResize: function() {
|
||||||
this.setState({ height: window.innerHeight - 100 });
|
this.setState({ height: window.innerHeight - 100 });
|
||||||
},
|
},
|
||||||
|
|
File diff suppressed because one or more lines are too long
Loading…
Reference in New Issue