Clear settings caches on reset rather than custom lifecycle method (#12859)
* Clear settings caches on reset Signed-off-by: Michael Telatynski <7t3chguy@gmail.com> * Derp Signed-off-by: Michael Telatynski <7t3chguy@gmail.com> * Delint Signed-off-by: Michael Telatynski <7t3chguy@gmail.com> --------- Signed-off-by: Michael Telatynski <7t3chguy@gmail.com>dbkr/sss
parent
090586439f
commit
54e5321f39
|
@ -58,7 +58,6 @@ import { setSentryUser } from "./sentry";
|
||||||
import SdkConfig from "./SdkConfig";
|
import SdkConfig from "./SdkConfig";
|
||||||
import { DialogOpener } from "./utils/DialogOpener";
|
import { DialogOpener } from "./utils/DialogOpener";
|
||||||
import { Action } from "./dispatcher/actions";
|
import { Action } from "./dispatcher/actions";
|
||||||
import AbstractLocalStorageSettingsHandler from "./settings/handlers/AbstractLocalStorageSettingsHandler";
|
|
||||||
import { OverwriteLoginPayload } from "./dispatcher/payloads/OverwriteLoginPayload";
|
import { OverwriteLoginPayload } from "./dispatcher/payloads/OverwriteLoginPayload";
|
||||||
import { SdkContextClass } from "./contexts/SDKContext";
|
import { SdkContextClass } from "./contexts/SDKContext";
|
||||||
import { messageForLoginError } from "./utils/ErrorUtils";
|
import { messageForLoginError } from "./utils/ErrorUtils";
|
||||||
|
@ -1087,7 +1086,6 @@ async function clearStorage(opts?: { deleteEverything?: boolean }): Promise<void
|
||||||
const registrationTime = window.localStorage.getItem("mx_registration_time");
|
const registrationTime = window.localStorage.getItem("mx_registration_time");
|
||||||
|
|
||||||
window.localStorage.clear();
|
window.localStorage.clear();
|
||||||
AbstractLocalStorageSettingsHandler.clear();
|
|
||||||
|
|
||||||
try {
|
try {
|
||||||
await StorageAccess.idbDelete("account", ACCESS_TOKEN_STORAGE_KEY);
|
await StorageAccess.idbDelete("account", ACCESS_TOKEN_STORAGE_KEY);
|
||||||
|
|
|
@ -35,8 +35,7 @@ export default abstract class AbstractLocalStorageSettingsHandler extends Settin
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
// Expose the clear event for Lifecycle to call, the storage listener only fires for changes from other tabs
|
private static clear(): void {
|
||||||
public static clear(): void {
|
|
||||||
AbstractLocalStorageSettingsHandler.itemCache.clear();
|
AbstractLocalStorageSettingsHandler.itemCache.clear();
|
||||||
AbstractLocalStorageSettingsHandler.objectCache.clear();
|
AbstractLocalStorageSettingsHandler.objectCache.clear();
|
||||||
}
|
}
|
||||||
|
@ -108,4 +107,8 @@ export default abstract class AbstractLocalStorageSettingsHandler extends Settin
|
||||||
public isSupported(): boolean {
|
public isSupported(): boolean {
|
||||||
return localStorage !== undefined && localStorage !== null;
|
return localStorage !== undefined && localStorage !== null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public reset(): void {
|
||||||
|
AbstractLocalStorageSettingsHandler.clear();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue