1
0
mirror of https://github.com/bitwarden/browser.git synced 2024-11-23 11:56:00 +01:00

Clean up the cached account (#672)

* Clean up the cached account

* PR feedback: Avoid duplicate code
This commit is contained in:
Daniel James Smith 2022-02-11 14:06:40 +01:00 committed by GitHub
parent fd0410ca4b
commit eaf387435f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -2425,13 +2425,14 @@ export class StateService<
protected removeAccountFromMemory(userId: string = this.state.activeUserId): void { protected removeAccountFromMemory(userId: string = this.state.activeUserId): void {
delete this.state.accounts[userId]; delete this.state.accounts[userId];
this.accountDiskCache.delete(userId);
} }
protected async pruneInMemoryAccounts() { protected async pruneInMemoryAccounts() {
// We preserve settings for logged out accounts, but we don't want to consider them when thinking about active account state // We preserve settings for logged out accounts, but we don't want to consider them when thinking about active account state
for (const userId in this.state.accounts) { for (const userId in this.state.accounts) {
if (!(await this.getIsAuthenticated({ userId: userId }))) { if (!(await this.getIsAuthenticated({ userId: userId }))) {
delete this.state.accounts[userId]; this.removeAccountFromMemory(userId);
} }
} }
} }