Review comments
This commit is contained in:
parent
53f3b5780e
commit
cca266c62c
2 changed files with 3 additions and 18 deletions
|
@ -380,21 +380,10 @@ export function startMatrixClient() {
|
||||||
*/
|
*/
|
||||||
export function onLoggedOut() {
|
export function onLoggedOut() {
|
||||||
_clearLocalStorage();
|
_clearLocalStorage();
|
||||||
_clearIndexedDB();
|
|
||||||
stopMatrixClient();
|
stopMatrixClient();
|
||||||
dis.dispatch({action: 'on_logged_out'});
|
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() {
|
function _clearLocalStorage() {
|
||||||
if (!window.localStorage) {
|
if (!window.localStorage) {
|
||||||
return;
|
return;
|
||||||
|
@ -423,6 +412,7 @@ export function stopMatrixClient() {
|
||||||
if (cli) {
|
if (cli) {
|
||||||
cli.stopClient();
|
cli.stopClient();
|
||||||
cli.removeAllListeners();
|
cli.removeAllListeners();
|
||||||
|
cli.store.deleteAllData();
|
||||||
MatrixClientPeg.unset();
|
MatrixClientPeg.unset();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -73,13 +73,8 @@ class MatrixClientPeg {
|
||||||
// the react sdk doesn't work without this, so don't allow
|
// the react sdk doesn't work without this, so don't allow
|
||||||
opts.pendingEventOrdering = "detached";
|
opts.pendingEventOrdering = "detached";
|
||||||
|
|
||||||
let promise = q();
|
let promise = this.matrixClient.store.startup();
|
||||||
if (this.matrixClient.store instanceof Matrix.IndexedDBStore) {
|
// log any errors when starting up the database (if one exists)
|
||||||
// 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
|
|
||||||
promise.catch((err) => { console.error(err); });
|
promise.catch((err) => { console.error(err); });
|
||||||
|
|
||||||
// regardless of errors, start the client. If we did error out, we'll
|
// regardless of errors, start the client. If we did error out, we'll
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue