diff --git a/src/Lifecycle.js b/src/Lifecycle.js index d5683b35a0..295ffe44f4 100644 --- a/src/Lifecycle.js +++ b/src/Lifecycle.js @@ -380,21 +380,10 @@ export function startMatrixClient() { */ export function onLoggedOut() { _clearLocalStorage(); - _clearIndexedDB(); stopMatrixClient(); dis.dispatch({action: 'on_logged_out'}); } -function _clearIndexedDB() { - // remove indexeddb instances - if (!window.indexedDB) { - return; - } - console.log("Clearing indexeddb"); - window.indexedDB.deleteDatabase("matrix-js-sdk"); - // TODO: Remove logs db as well. -} - function _clearLocalStorage() { if (!window.localStorage) { return; @@ -423,6 +412,7 @@ export function stopMatrixClient() { if (cli) { cli.stopClient(); cli.removeAllListeners(); + cli.store.deleteAllData(); MatrixClientPeg.unset(); } } diff --git a/src/MatrixClientPeg.js b/src/MatrixClientPeg.js index 0267b36464..3759aa72c1 100644 --- a/src/MatrixClientPeg.js +++ b/src/MatrixClientPeg.js @@ -73,13 +73,8 @@ class MatrixClientPeg { // the react sdk doesn't work without this, so don't allow opts.pendingEventOrdering = "detached"; - let promise = q(); - if (this.matrixClient.store instanceof Matrix.IndexedDBStore) { - // load from storage before starting up. - console.log("Loading history from IndexedDB."); - promise = this.matrixClient.store.startup(); - } - // log any errors when starting up the database + let promise = this.matrixClient.store.startup(); + // log any errors when starting up the database (if one exists) promise.catch((err) => { console.error(err); }); // regardless of errors, start the client. If we did error out, we'll