From 9ef9d09d44548c066b0186b87eeac2015922dc7f Mon Sep 17 00:00:00 2001 From: David Baker Date: Wed, 21 Jun 2017 11:27:18 +0100 Subject: [PATCH] Fix another race with first-sync Set the first sync variables in onWillStartClient, as they race if set on logged in (similar fix to https://github.com/matrix-org/matrix-react-sdk/pull/1124) --- src/components/structures/MatrixChat.js | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/src/components/structures/MatrixChat.js b/src/components/structures/MatrixChat.js index 87799640bd..4b85ae1722 100644 --- a/src/components/structures/MatrixChat.js +++ b/src/components/structures/MatrixChat.js @@ -942,10 +942,6 @@ module.exports = React.createClass({ dis.dispatch({action: 'view_home_page'}); } else if (this._is_registered) { this._is_registered = false; - // reset the 'have completed first sync' flag, - // since we've just logged in and will be about to sync - this.firstSyncComplete = false; - this.firstSyncPromise = q.defer(); // Set the display name = user ID localpart MatrixClientPeg.get().setDisplayName( @@ -1015,6 +1011,12 @@ module.exports = React.createClass({ // Set ready to false now, then it'll be set to true when the sync // listener we set below fires. this.setState({ready: false}); + + // reset the 'have completed first sync' flag, + // since we're about to start the client and therefore about + // to do the first sync + this.firstSyncComplete = false; + this.firstSyncPromise = q.defer(); const cli = MatrixClientPeg.get(); // Allow the JS SDK to reap timeline events. This reduces the amount of