mirror of
https://github.com/element-hq/element-web
synced 2024-11-27 11:47:23 +03:00
Fix version going blank after logging in
Don't use replaceState in MatrixClient: there's lots of stuff in MatrixClient's state now (including the app version) so replacing the entire state doesn't really make sense (and also blows away all of the nice defaults we set in getInitialState). Instead, setState of the things we actually care about wherever we used replaceState. Also add a couple of state variables to getInitialState that were missing. Fixes https://github.com/vector-im/vector-web/issues/2322
This commit is contained in:
parent
66ef1e8156
commit
8cbddfcf28
1 changed files with 36 additions and 6 deletions
|
@ -105,6 +105,9 @@ module.exports = React.createClass({
|
|||
|
||||
version: null,
|
||||
newVersion: null,
|
||||
|
||||
upgradeUsername: null,
|
||||
guestAccessToken: null,
|
||||
};
|
||||
return s;
|
||||
},
|
||||
|
@ -261,13 +264,20 @@ module.exports = React.createClass({
|
|||
newState.register_is_url = payload.params.is_url;
|
||||
newState.register_id_sid = payload.params.sid;
|
||||
}
|
||||
this.replaceState(newState);
|
||||
this.setState(newState);
|
||||
this.notifyNewScreen('register');
|
||||
break;
|
||||
case 'start_login':
|
||||
if (this.state.logged_in) return;
|
||||
this.replaceState({
|
||||
this.setState({
|
||||
screen: 'login',
|
||||
currentRoomAlias: null,
|
||||
currentRoomId: null,
|
||||
viewUserId: null,
|
||||
logged_in: false,
|
||||
ready: false,
|
||||
upgradeUsername: null,
|
||||
guestAccessToken: null,
|
||||
});
|
||||
this.notifyNewScreen('login');
|
||||
break;
|
||||
|
@ -279,8 +289,13 @@ module.exports = React.createClass({
|
|||
case 'start_upgrade_registration':
|
||||
// stash our guest creds so we can backout if needed
|
||||
this.guestCreds = MatrixClientPeg.getCredentials();
|
||||
this.replaceState({
|
||||
this.setState({
|
||||
screen: "register",
|
||||
currentRoomAlias: null,
|
||||
currentRoomId: null,
|
||||
viewUserId: null,
|
||||
logged_in: false,
|
||||
ready: false,
|
||||
upgradeUsername: MatrixClientPeg.get().getUserIdLocalpart(),
|
||||
guestAccessToken: MatrixClientPeg.get().getAccessToken(),
|
||||
});
|
||||
|
@ -288,8 +303,15 @@ module.exports = React.createClass({
|
|||
break;
|
||||
case 'start_password_recovery':
|
||||
if (this.state.logged_in) return;
|
||||
this.replaceState({
|
||||
screen: 'forgot_password'
|
||||
this.setState({
|
||||
screen: 'forgot_password',
|
||||
currentRoomAlias: null,
|
||||
currentRoomId: null,
|
||||
viewUserId: null,
|
||||
logged_in: false,
|
||||
ready: false,
|
||||
upgradeUsername: null,
|
||||
guestAccessToken: null,
|
||||
});
|
||||
this.notifyNewScreen('forgot_password');
|
||||
break;
|
||||
|
@ -595,9 +617,17 @@ module.exports = React.createClass({
|
|||
*/
|
||||
_onLoggedOut: function() {
|
||||
this.notifyNewScreen('login');
|
||||
this.replaceState({
|
||||
this.setState({
|
||||
screen: undefined,
|
||||
currentRoomAlias: null,
|
||||
currentRoomId: null,
|
||||
viewUserId: null,
|
||||
logged_in: false,
|
||||
ready: false,
|
||||
upgradeUsername: null,
|
||||
guestAccessToken: null,
|
||||
collapse_lhs: false,
|
||||
collapse_rhs: false,
|
||||
});
|
||||
},
|
||||
|
||||
|
|
Loading…
Reference in a new issue