mirror of
https://github.com/vector-im/element-web.git
synced 2024-11-17 14:05:04 +08:00
Unmounted guard
This commit is contained in:
parent
ec560345c7
commit
10f15dfc56
@ -97,6 +97,8 @@ export default React.createClass({
|
||||
},
|
||||
|
||||
componentWillMount: function() {
|
||||
this._unmounted = false;
|
||||
|
||||
const roomMembers = this.props.room.getJoinedMembers().map((m) => {
|
||||
return m.userId;
|
||||
});
|
||||
@ -106,6 +108,8 @@ export default React.createClass({
|
||||
devices: null,
|
||||
});
|
||||
MatrixClientPeg.get().downloadKeys(roomMembers, false).then((devices) => {
|
||||
if (this._unmounted) return;
|
||||
|
||||
const unknownDevices = {};
|
||||
// This is all devices in this room, so find the unknown ones.
|
||||
Object.keys(devices).forEach((userId) => {
|
||||
@ -133,6 +137,10 @@ export default React.createClass({
|
||||
});
|
||||
},
|
||||
|
||||
componentWillUnmount: function() {
|
||||
this._unmounted = true;
|
||||
},
|
||||
|
||||
render: function() {
|
||||
if (this.state.devices === null) {
|
||||
const Spinner = sdk.getComponent("elements.Spinner");
|
||||
|
Loading…
Reference in New Issue
Block a user