Skip to content
This repository was archived by the owner on Sep 11, 2024. It is now read-only.

Commit 61c5384

Browse files
committed
Fix another infinite spin on register
Don't set ready on logging_in, set it before we start the client, as commented
1 parent 0e71918 commit 61c5384

File tree

1 file changed

+7
-4
lines changed

1 file changed

+7
-4
lines changed

src/components/structures/MatrixChat.js

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -500,10 +500,9 @@ module.exports = React.createClass({
500500
break;
501501
case 'on_logging_in':
502502
// We are now logging in, so set the state to reflect that
503-
// and also that we're not ready (we'll be marked as logged
504-
// in once the login completes, then ready once the sync
505-
// completes).
506-
this.setState({loggingIn: true, ready: false});
503+
// NB. This does not touch 'ready' since if our dispatches
504+
// are delayed, the sync could already have completed
505+
this.setState({loggingIn: true});
507506
break;
508507
case 'on_logged_in':
509508
this._onLoggedIn(payload.teamToken);
@@ -989,6 +988,10 @@ module.exports = React.createClass({
989988
*/
990989
_onWillStartClient() {
991990
const self = this;
991+
// if the client is about to start, we are, by definition, not ready.
992+
// Set ready to false now, then it'll be set to true when the sync
993+
// listener we set below fires.
994+
this.setState({ready: false});
992995
const cli = MatrixClientPeg.get();
993996

994997
// Allow the JS SDK to reap timeline events. This reduces the amount of

0 commit comments

Comments
 (0)