diff --git a/src/controllers/organisms/MemberList.js b/src/controllers/organisms/MemberList.js index 7d188b6c..a511816d 100644 --- a/src/controllers/organisms/MemberList.js +++ b/src/controllers/organisms/MemberList.js @@ -43,6 +43,7 @@ module.exports = { componentDidMount: function() { var that = this; setTimeout(function() { + if (!that.isMounted()) return; that.setState({ memberDict: that.roomMembers() }); diff --git a/src/controllers/organisms/RoomView.js b/src/controllers/organisms/RoomView.js index d2fec9d9..b3ea6666 100644 --- a/src/controllers/organisms/RoomView.js +++ b/src/controllers/organisms/RoomView.js @@ -61,6 +61,8 @@ module.exports = { },*/ onRoomTimeline: function(ev, room, toStartOfTimeline) { + if (!this.isMounted()) return; + // ignore anything that comes in whilst pagingating: we get one // event for each new matrix event so this would cause a huge // number of UI updates. Just update the UI when the paginate @@ -129,9 +131,11 @@ module.exports = { var that = this; MatrixClientPeg.get().scrollback(this.state.room, PAGINATE_SIZE).finally(function() { that.waiting_for_paginate = false; - that.setState({ - room: MatrixClientPeg.get().getRoom(that.props.roomId) - }); + if (that.isMounted()) { + that.setState({ + room: MatrixClientPeg.get().getRoom(that.props.roomId) + }); + } // wait and set paginating to false when the component updates }); }