Some checks to see whether stuff is still mounted when adding things.
This commit is contained in:
parent
30a9436485
commit
9aa9a60333
2 changed files with 8 additions and 3 deletions
|
@ -43,6 +43,7 @@ module.exports = {
|
||||||
componentDidMount: function() {
|
componentDidMount: function() {
|
||||||
var that = this;
|
var that = this;
|
||||||
setTimeout(function() {
|
setTimeout(function() {
|
||||||
|
if (!that.isMounted()) return;
|
||||||
that.setState({
|
that.setState({
|
||||||
memberDict: that.roomMembers()
|
memberDict: that.roomMembers()
|
||||||
});
|
});
|
||||||
|
|
|
@ -61,6 +61,8 @@ module.exports = {
|
||||||
},*/
|
},*/
|
||||||
|
|
||||||
onRoomTimeline: function(ev, room, toStartOfTimeline) {
|
onRoomTimeline: function(ev, room, toStartOfTimeline) {
|
||||||
|
if (!this.isMounted()) return;
|
||||||
|
|
||||||
// ignore anything that comes in whilst pagingating: we get one
|
// ignore anything that comes in whilst pagingating: we get one
|
||||||
// event for each new matrix event so this would cause a huge
|
// event for each new matrix event so this would cause a huge
|
||||||
// number of UI updates. Just update the UI when the paginate
|
// number of UI updates. Just update the UI when the paginate
|
||||||
|
@ -129,9 +131,11 @@ module.exports = {
|
||||||
var that = this;
|
var that = this;
|
||||||
MatrixClientPeg.get().scrollback(this.state.room, PAGINATE_SIZE).finally(function() {
|
MatrixClientPeg.get().scrollback(this.state.room, PAGINATE_SIZE).finally(function() {
|
||||||
that.waiting_for_paginate = false;
|
that.waiting_for_paginate = false;
|
||||||
that.setState({
|
if (that.isMounted()) {
|
||||||
room: MatrixClientPeg.get().getRoom(that.props.roomId)
|
that.setState({
|
||||||
});
|
room: MatrixClientPeg.get().getRoom(that.props.roomId)
|
||||||
|
});
|
||||||
|
}
|
||||||
// wait and set paginating to false when the component updates
|
// wait and set paginating to false when the component updates
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue