Skip to content

Commit 9aa9a60

Browse files
committed
Some checks to see whether stuff is still mounted when adding things.
1 parent 30a9436 commit 9aa9a60

2 files changed

Lines changed: 8 additions & 3 deletions

File tree

‎src/controllers/organisms/MemberList.js‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@ module.exports = {
4343
componentDidMount: function() {
4444
var that = this;
4545
setTimeout(function() {
46+
if (!that.isMounted()) return;
4647
that.setState({
4748
memberDict: that.roomMembers()
4849
});

‎src/controllers/organisms/RoomView.js‎

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,8 @@ module.exports = {
6161
},*/
6262

6363
onRoomTimeline: function(ev, room, toStartOfTimeline) {
64+
if (!this.isMounted()) return;
65+
6466
// ignore anything that comes in whilst pagingating: we get one
6567
// event for each new matrix event so this would cause a huge
6668
// number of UI updates. Just update the UI when the paginate
@@ -129,9 +131,11 @@ module.exports = {
129131
var that = this;
130132
MatrixClientPeg.get().scrollback(this.state.room, PAGINATE_SIZE).finally(function() {
131133
that.waiting_for_paginate = false;
132-
that.setState({
133-
room: MatrixClientPeg.get().getRoom(that.props.roomId)
134-
});
134+
if (that.isMounted()) {
135+
that.setState({
136+
room: MatrixClientPeg.get().getRoom(that.props.roomId)
137+
});
138+
}
135139
// wait and set paginating to false when the component updates
136140
});
137141
}

0 commit comments

Comments
 (0)