Cancel calls to rate-limited funcs on unmount
The tests were throwing up warnings about state being accessed, and null MatrixClients being called, after component unmount.
This commit is contained in:
parent
6aa5e5a493
commit
8fe470bce1
5 changed files with 34 additions and 3 deletions
|
@ -58,6 +58,8 @@ module.exports = React.createClass({
|
|||
if (cli) {
|
||||
cli.removeListener("RoomState.members", this.onRoomStateMember);
|
||||
}
|
||||
// cancel any pending calls to the rate_limited_funcs
|
||||
this._updateList.cancelPendingCall();
|
||||
},
|
||||
|
||||
_updateList: new rate_limited_func(function() {
|
||||
|
@ -100,7 +102,7 @@ module.exports = React.createClass({
|
|||
<EntityTile key="dynamic_invite_tile" suppressOnHover={true} showInviteButton={true}
|
||||
avatarJsx={ <BaseAvatar name="@" width={36} height={36} /> }
|
||||
className="mx_EntityTile_invitePlaceholder"
|
||||
presenceState="online" onClick={this.onThirdPartyInvite} name={"Invite by email"}
|
||||
presenceState="online" onClick={this.onThirdPartyInvite} name={"Invite by email"}
|
||||
/>,
|
||||
function(query) {
|
||||
return true; // always show this
|
||||
|
|
|
@ -81,6 +81,9 @@ module.exports = React.createClass({
|
|||
cli.removeListener("User.lastPresenceTs", this.onUserLastPresenceTs);
|
||||
// cli.removeListener("Room.timeline", this.onRoomTimeline);
|
||||
}
|
||||
|
||||
// cancel any pending calls to the rate_limited_funcs
|
||||
this._updateList.cancelPendingCall();
|
||||
},
|
||||
|
||||
/*
|
||||
|
|
|
@ -101,6 +101,8 @@ module.exports = React.createClass({
|
|||
MatrixClientPeg.get().removeListener("RoomState.events", this.onRoomStateEvents);
|
||||
MatrixClientPeg.get().removeListener("RoomMember.name", this.onRoomMemberName);
|
||||
}
|
||||
// cancel any pending calls to the rate_limited_funcs
|
||||
this._delayedRefreshRoomList.cancelPendingCall();
|
||||
},
|
||||
|
||||
onRoom: function(room) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue