mirror of https://github.com/vector-im/riot-web
Merge pull request #1737 from matrix-org/rav/roomview_unmounted
RoomView: guard against unmounting during peekingpull/21833/head
commit
754b7fbad5
|
@ -264,12 +264,19 @@ module.exports = React.createClass({
|
||||||
isPeeking: true, // this will change to false if peeking fails
|
isPeeking: true, // this will change to false if peeking fails
|
||||||
});
|
});
|
||||||
MatrixClientPeg.get().peekInRoom(roomId).then((room) => {
|
MatrixClientPeg.get().peekInRoom(roomId).then((room) => {
|
||||||
|
if (this.unmounted) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
this.setState({
|
this.setState({
|
||||||
room: room,
|
room: room,
|
||||||
peekLoading: false,
|
peekLoading: false,
|
||||||
});
|
});
|
||||||
this._onRoomLoaded(room);
|
this._onRoomLoaded(room);
|
||||||
}, (err) => {
|
}, (err) => {
|
||||||
|
if (this.unmounted) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
// Stop peeking if anything went wrong
|
// Stop peeking if anything went wrong
|
||||||
this.setState({
|
this.setState({
|
||||||
isPeeking: false,
|
isPeeking: false,
|
||||||
|
@ -286,7 +293,7 @@ module.exports = React.createClass({
|
||||||
} else {
|
} else {
|
||||||
throw err;
|
throw err;
|
||||||
}
|
}
|
||||||
}).done();
|
});
|
||||||
}
|
}
|
||||||
} else if (room) {
|
} else if (room) {
|
||||||
// Stop peeking because we have joined this room previously
|
// Stop peeking because we have joined this room previously
|
||||||
|
|
Loading…
Reference in New Issue