Don't allow UserSettings to render if !MatrixClientPeg.get()
Now that it has state that updates following the nulling of the MCP (userHasGeneratedPassword) we need to stop it from rendering if the MCP is null. Fixes https://github.com/vector-im/riot-web/issues/4319
This commit is contained in:
parent
f7a22cccb6
commit
3320df4cdd
1 changed files with 10 additions and 0 deletions
|
@ -276,6 +276,16 @@ module.exports = React.createClass({
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
|
// `UserSettings` assumes that the client peg will not be null, so give it some
|
||||||
|
// sort of assurance here by only allowing a re-render if the client is truthy.
|
||||||
|
//
|
||||||
|
// This is required because `UserSettings` maintains its own state and if this state
|
||||||
|
// updates (e.g. during _setStateFromSessionStore) after the client peg has been made
|
||||||
|
// null (during logout), then it will attempt to re-render and throw errors.
|
||||||
|
shouldComponentUpdate: function() {
|
||||||
|
return Boolean(MatrixClientPeg.get());
|
||||||
|
},
|
||||||
|
|
||||||
_setStateFromSessionStore: function() {
|
_setStateFromSessionStore: function() {
|
||||||
this.setState({
|
this.setState({
|
||||||
userHasGeneratedPassword: Boolean(this._sessionStore.getCachedPassword()),
|
userHasGeneratedPassword: Boolean(this._sessionStore.getCachedPassword()),
|
||||||
|
|
Loading…
Reference in a new issue