From 61c538485548001aa44844fbc0258cd1a7d3345b Mon Sep 17 00:00:00 2001 From: David Baker Date: Tue, 20 Jun 2017 12:03:37 +0100 Subject: [PATCH] Fix another infinite spin on register Don't set ready on logging_in, set it before we start the client, as commented --- src/components/structures/MatrixChat.js | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/src/components/structures/MatrixChat.js b/src/components/structures/MatrixChat.js index 7b1855b678..e5aefdf665 100644 --- a/src/components/structures/MatrixChat.js +++ b/src/components/structures/MatrixChat.js @@ -500,10 +500,9 @@ module.exports = React.createClass({ break; case 'on_logging_in': // We are now logging in, so set the state to reflect that - // and also that we're not ready (we'll be marked as logged - // in once the login completes, then ready once the sync - // completes). - this.setState({loggingIn: true, ready: false}); + // NB. This does not touch 'ready' since if our dispatches + // are delayed, the sync could already have completed + this.setState({loggingIn: true}); break; case 'on_logged_in': this._onLoggedIn(payload.teamToken); @@ -989,6 +988,10 @@ module.exports = React.createClass({ */ _onWillStartClient() { const self = this; + // if the client is about to start, we are, by definition, not ready. + // Set ready to false now, then it'll be set to true when the sync + // listener we set below fires. + this.setState({ready: false}); const cli = MatrixClientPeg.get(); // Allow the JS SDK to reap timeline events. This reduces the amount of