diff --git a/src/BasePlatform.ts b/src/BasePlatform.ts index 7280b6bb3d7..edafff229fa 100644 --- a/src/BasePlatform.ts +++ b/src/BasePlatform.ts @@ -442,4 +442,12 @@ export default abstract class BasePlatform { logger.error("idbDelete failed in destroyPickleKey", e); } } + + /** + * Clear app storage, called when logging out to perform data clean up. + */ + public async clearStorage(): Promise { + window.sessionStorage.clear(); + window.localStorage.clear(); + } } diff --git a/src/Lifecycle.ts b/src/Lifecycle.ts index 5122b0a632f..b1f12232a57 100644 --- a/src/Lifecycle.ts +++ b/src/Lifecycle.ts @@ -862,6 +862,7 @@ export async function onLoggedOut(): Promise { stopMatrixClient(); await clearStorage({ deleteEverything: true }); LifecycleCustomisations.onLoggedOutAndStorageCleared?.(); + await PlatformPeg.get()?.clearStorage(); // Do this last, so we can make sure all storage has been cleared and all // customisations got the memo.