Skip to content
This repository has been archived by the owner on Sep 11, 2024. It is now read-only.

Commit

Permalink
Merge pull request #2128 from matrix-org/dbkr/move_tiffany_check
Browse files Browse the repository at this point in the history
Fix CPU spin on joining large room
  • Loading branch information
dbkr committed Aug 23, 2018
2 parents b34aad5 + a5f98b6 commit 269670e
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/components/structures/RoomView.js
Original file line number Diff line number Diff line change
Expand Up @@ -701,7 +701,6 @@ module.exports = React.createClass({
}

this._updateRoomMembers();
this._checkIfAlone(this.state.room);
},

onRoomMemberMembership: function(ev, member, oldMembership) {
Expand All @@ -717,6 +716,7 @@ module.exports = React.createClass({
// refresh the conf call notification state
this._updateConfCallNotification();
this._updateDMState();
this._checkIfAlone(this.state.room);
}, 500),

_checkIfAlone: function(room) {
Expand All @@ -729,8 +729,8 @@ module.exports = React.createClass({
return;
}

const joinedMembers = room.currentState.getMembers().filter((m) => m.membership === "join" || m.membership === "invite");
this.setState({isAlone: joinedMembers.length === 1});
const joinedOrInvitedMemberCount = room.getJoinedMemberCount() + room.getInvitedMemberCount();
this.setState({isAlone: joinedOrInvitedMemberCount === 1});
},

_updateConfCallNotification: function() {
Expand Down

0 comments on commit 269670e

Please sign in to comment.