Merge pull request #3979 from matrix-org/dbkr/no_peeking

Don't peek until the matrix client is ready
pull/21833/head
David Baker 2020-01-29 15:17:33 +00:00 committed by GitHub
commit b804a1cedb
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 10 additions and 1 deletions

View File

@ -46,6 +46,7 @@ const INITIAL_STATE = {
forwardingEvent: null,
quotingEvent: null,
matrixClientIsReady: false,
};
/**
@ -59,6 +60,9 @@ class RoomViewStore extends Store {
// Initialise state
this._state = INITIAL_STATE;
if (MatrixClientPeg.get()) {
this._state.matrixClientIsReady = MatrixClientPeg.get().isInitialSyncComplete();
}
}
_setState(newState) {
@ -136,6 +140,11 @@ class RoomViewStore extends Store {
}, /*className=*/null, /*isPriority=*/false, /*isStatic=*/true);
break;
}
case 'sync_state':
this._setState({
matrixClientIsReady: MatrixClientPeg.get().isInitialSyncComplete(),
});
break;
}
}
@ -350,7 +359,7 @@ class RoomViewStore extends Store {
}
shouldPeek() {
return this._state.shouldPeek;
return this._state.shouldPeek && this._state.matrixClientIsReady;
}
}