Add state loggingIn to MatrixChat to fix flashing login
To prevent the login screen from flashing when refreshing the app, use some state to indicate that a login is in progress, and OR that with the existing `loading` boolean to show the `<Spinner>` instead of the default `<Login>`. This might be too invasive, and a default spinner may be better.
This commit is contained in:
parent
a8d85ca2ad
commit
30c5af35e5
2 changed files with 14 additions and 1 deletions
|
@ -276,6 +276,11 @@ export function setLoggedIn(credentials) {
|
|||
console.log("setLoggedIn => %s (guest=%s) hs=%s",
|
||||
credentials.userId, credentials.guest,
|
||||
credentials.homeserverUrl);
|
||||
// This is dispatched to indicate that the user is still in the process of logging in
|
||||
// because `teamPromise` may take some time to resolve, breaking the assumption that
|
||||
// `setLoggedIn` takes an "instant" to complete, and dispatch `on_logged_in` a few ms
|
||||
// later than MatrixChat might assume.
|
||||
dis.dispatch({action: 'on_logging_in'});
|
||||
|
||||
// Resolves by default
|
||||
let teamPromise = Promise.resolve(null);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue