@@ -73,9 +73,8 @@ dis.register((payload) => {
73
73
onLoggedOut ( ) ;
74
74
} else if ( payload . action === Action . OverwriteLogin ) {
75
75
const typed = < OverwriteLoginPayload > payload ;
76
- // is invoked without dispatching of "on_logging_in"
77
76
// noinspection JSIgnoredPromiseFromCall - we don't care if it fails
78
- doSetLoggedIn ( typed . credentials , true , false ) ;
77
+ doSetLoggedIn ( typed . credentials , true ) ;
79
78
}
80
79
} ) ;
81
80
@@ -569,19 +568,15 @@ export async function hydrateSession(credentials: IMatrixClientCreds): Promise<M
569
568
}
570
569
571
570
/**
572
- * fires on_logging_in, optionally clears localstorage, persists new credentials
571
+ * optionally clears localstorage, persists new credentials
573
572
* to localstorage, starts the new client.
574
573
*
575
574
* @param {IMatrixClientCreds } credentials
576
575
* @param {Boolean } clearStorageEnabled
577
- * @param { Boolean } dispatchOnLoggingIn if true then "on_logging_in" is dispatched
576
+ *
578
577
* @returns {Promise } promise which resolves to the new MatrixClient once it has been started
579
578
*/
580
- async function doSetLoggedIn (
581
- credentials : IMatrixClientCreds ,
582
- clearStorageEnabled : boolean ,
583
- dispatchOnLoggingIn = true ,
584
- ) : Promise < MatrixClient > {
579
+ async function doSetLoggedIn ( credentials : IMatrixClientCreds , clearStorageEnabled : boolean ) : Promise < MatrixClient > {
585
580
credentials . guest = Boolean ( credentials . guest ) ;
586
581
587
582
const softLogout = isSoftLogout ( ) ;
@@ -600,20 +595,6 @@ async function doSetLoggedIn(
600
595
" freshLogin: " + credentials . freshLogin ,
601
596
) ;
602
597
603
- // This is dispatched to indicate that the user is still in the process of logging in
604
- // because async code may take some time to resolve, breaking the assumption that
605
- // `setLoggedIn` takes an "instant" to complete, and dispatch `on_logged_in` a few ms
606
- // later than MatrixChat might assume.
607
- //
608
- // we fire it *synchronously* to make sure it fires before on_logged_in.
609
- // (dis.dispatch uses `window.setTimeout`, which does not guarantee ordering.)
610
- //
611
- // can be disabled to resolve "Cannot dispatch in the middle of a dispatch."
612
- // error when it is invoked via another dispatch that is not yet finished.
613
- if ( dispatchOnLoggingIn ) {
614
- dis . dispatch ( { action : "on_logging_in" } , true ) ;
615
- }
616
-
617
598
if ( clearStorageEnabled ) {
618
599
await clearStorage ( ) ;
619
600
}
0 commit comments