1
0
mirror of https://github.com/matrix-org/matrix-react-sdk.git synced 2025-08-07 21:23:00 +03:00

Fix font not resetting when logging out (#8670)

* Fix font not resetting when logging out

* Adopt on_logged_in and on_logged_out into DispatcherAction

* Add tests

* Add copyright
This commit is contained in:
Michael Telatynski
2022-05-26 09:56:53 +01:00
committed by GitHub
parent f3b762c1a8
commit d75e2f19c5
11 changed files with 97 additions and 39 deletions

View File

@@ -632,7 +632,7 @@ async function doSetLoggedIn(
logger.warn("No local storage available: can't persist session!");
}
dis.dispatch({ action: 'on_logged_in' });
dis.fire(Action.OnLoggedIn);
await startMatrixClient(/*startSyncing=*/!softLogout);
return client;
@@ -857,15 +857,15 @@ async function startMatrixClient(startSyncing = true): Promise<void> {
*/
export async function onLoggedOut(): Promise<void> {
_isLoggingOut = false;
// Ensure that we dispatch a view change **before** stopping the client so
// Ensure that we dispatch a view change **before** stopping the client,
// so that React components unmount first. This avoids React soft crashes
// that can occur when components try to use a null client.
dis.dispatch({ action: 'on_logged_out' }, true);
dis.fire(Action.OnLoggedOut, true);
stopMatrixClient();
await clearStorage({ deleteEverything: true });
LifecycleCustomisations.onLoggedOutAndStorageCleared?.();
// Do this last so we can make sure all storage has been cleared and all
// Do this last, so we can make sure all storage has been cleared and all
// customisations got the memo.
if (SdkConfig.get().logout_redirect_url) {
logger.log("Redirecting to external provider to finish logout");