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

Commit 2db24f3

Browse files
committed
Fix another race with first-sync
Set the first sync variables in onWillStartClient, as they race if set on logged in (similar fix to #1124)
1 parent a62f6d1 commit 2db24f3

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

src/components/structures/MatrixChat.js

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -919,10 +919,6 @@ module.exports = React.createClass({
919919
dis.dispatch({action: 'view_home_page'});
920920
} else if (this._is_registered) {
921921
this._is_registered = false;
922-
// reset the 'have completed first sync' flag,
923-
// since we've just logged in and will be about to sync
924-
this.firstSyncComplete = false;
925-
this.firstSyncPromise = q.defer();
926922

927923
// Set the display name = user ID localpart
928924
MatrixClientPeg.get().setDisplayName(
@@ -992,6 +988,12 @@ module.exports = React.createClass({
992988
// Set ready to false now, then it'll be set to true when the sync
993989
// listener we set below fires.
994990
this.setState({ready: false});
991+
992+
// reset the 'have completed first sync' flag,
993+
// since we're about to start the client and therefore about
994+
// to do the first sync
995+
this.firstSyncComplete = false;
996+
this.firstSyncPromise = q.defer();
995997
const cli = MatrixClientPeg.get();
996998

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

0 commit comments

Comments
 (0)