Unmounted guard
parent
ec560345c7
commit
10f15dfc56
|
@ -97,6 +97,8 @@ export default React.createClass({
|
||||||
},
|
},
|
||||||
|
|
||||||
componentWillMount: function() {
|
componentWillMount: function() {
|
||||||
|
this._unmounted = false;
|
||||||
|
|
||||||
const roomMembers = this.props.room.getJoinedMembers().map((m) => {
|
const roomMembers = this.props.room.getJoinedMembers().map((m) => {
|
||||||
return m.userId;
|
return m.userId;
|
||||||
});
|
});
|
||||||
|
@ -106,6 +108,8 @@ export default React.createClass({
|
||||||
devices: null,
|
devices: null,
|
||||||
});
|
});
|
||||||
MatrixClientPeg.get().downloadKeys(roomMembers, false).then((devices) => {
|
MatrixClientPeg.get().downloadKeys(roomMembers, false).then((devices) => {
|
||||||
|
if (this._unmounted) return;
|
||||||
|
|
||||||
const unknownDevices = {};
|
const unknownDevices = {};
|
||||||
// This is all devices in this room, so find the unknown ones.
|
// This is all devices in this room, so find the unknown ones.
|
||||||
Object.keys(devices).forEach((userId) => {
|
Object.keys(devices).forEach((userId) => {
|
||||||
|
@ -133,6 +137,10 @@ export default React.createClass({
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|
||||||
|
componentWillUnmount: function() {
|
||||||
|
this._unmounted = true;
|
||||||
|
},
|
||||||
|
|
||||||
render: function() {
|
render: function() {
|
||||||
if (this.state.devices === null) {
|
if (this.state.devices === null) {
|
||||||
const Spinner = sdk.getComponent("elements.Spinner");
|
const Spinner = sdk.getComponent("elements.Spinner");
|
||||||
|
|
Loading…
Reference in New Issue