mirror of
https://github.com/vector-im/element-web.git
synced 2025-10-14 17:02:17 +02:00
Avoid logged in event race
This commit is contained in:
parent
71fa3222fe
commit
5926e277c4
@ -1820,12 +1820,9 @@ export default createReactClass({
|
|||||||
},
|
},
|
||||||
|
|
||||||
async onUserCompletedLoginFlow(credentials) {
|
async onUserCompletedLoginFlow(credentials) {
|
||||||
// Create and start the client in the background
|
|
||||||
Lifecycle.setLoggedIn(credentials);
|
|
||||||
|
|
||||||
// Wait for the client to be logged in (but not started)
|
// Wait for the client to be logged in (but not started)
|
||||||
// which is enough to ask the server about account data.
|
// which is enough to ask the server about account data.
|
||||||
await new Promise(resolve => {
|
const loggedIn = new Promise(resolve => {
|
||||||
const actionHandlerRef = dis.register(payload => {
|
const actionHandlerRef = dis.register(payload => {
|
||||||
if (payload.action !== "on_logged_in") {
|
if (payload.action !== "on_logged_in") {
|
||||||
return;
|
return;
|
||||||
@ -1835,6 +1832,10 @@ export default createReactClass({
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
// Create and start the client in the background
|
||||||
|
Lifecycle.setLoggedIn(credentials);
|
||||||
|
await loggedIn;
|
||||||
|
|
||||||
const cli = MatrixClientPeg.get();
|
const cli = MatrixClientPeg.get();
|
||||||
// We're checking `isCryptoAvailable` here instead of `isCryptoEnabled`
|
// We're checking `isCryptoAvailable` here instead of `isCryptoEnabled`
|
||||||
// because the client hasn't been started yet.
|
// because the client hasn't been started yet.
|
||||||
|
Loading…
x
Reference in New Issue
Block a user