Merge pull request #525 from matrix-org/dbkr/fix_spin_on_join

Fix CPU spin on joining rooms
This commit is contained in:
David Baker 2016-10-26 15:46:42 +01:00 committed by GitHub
commit 8395717f9b
2 changed files with 11 additions and 7 deletions

View file

@ -573,18 +573,17 @@ module.exports = React.createClass({
return; return;
} }
if (this.props.ConferenceHandler &&
member.userId === this.props.ConferenceHandler.getConferenceUserIdForRoom(member.roomId)) {
this._updateConfCallNotification();
}
this._updateRoomMembers(); this._updateRoomMembers();
}, },
// rate limited because a power level change will emit an event for every // rate limited because a power level change will emit an event for every
// member in the room. // member in the room.
_updateRoomMembers: new rate_limited_func(function() { _updateRoomMembers: new rate_limited_func(function() {
// a member state changed in this room, refresh the tab complete list // a member state changed in this room
// refresh the conf call notification state
this._updateConfCallNotification();
// refresh the tab complete list
this.tabComplete.loadEntries(this.state.room); this.tabComplete.loadEntries(this.state.room);
this._updateAutoComplete(); this._updateAutoComplete();

View file

@ -21,6 +21,7 @@ var sdk = require('../../../index');
var MatrixClientPeg = require('../../../MatrixClientPeg'); var MatrixClientPeg = require('../../../MatrixClientPeg');
var Modal = require("../../../Modal"); var Modal = require("../../../Modal");
var dis = require("../../../dispatcher"); var dis = require("../../../dispatcher");
var rate_limited_func = require('../../../ratelimitedfunc');
var linkify = require('linkifyjs'); var linkify = require('linkifyjs');
var linkifyElement = require('linkifyjs/element'); var linkifyElement = require('linkifyjs/element');
@ -85,9 +86,13 @@ module.exports = React.createClass({
} }
// redisplay the room name, topic, etc. // redisplay the room name, topic, etc.
this.forceUpdate(); this._rateLimitedUpdate();
}, },
_rateLimitedUpdate: new rate_limited_func(function() {
this.forceUpdate();
}, 500),
_onRoomNameChange: function(room) { _onRoomNameChange: function(room) {
this.forceUpdate(); this.forceUpdate();
}, },