From eaf387435f65158225ee7b6171a92f9af32b4f3e Mon Sep 17 00:00:00 2001 From: Daniel James Smith Date: Fri, 11 Feb 2022 14:06:40 +0100 Subject: [PATCH] Clean up the cached account (#672) * Clean up the cached account * PR feedback: Avoid duplicate code --- common/src/services/state.service.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/common/src/services/state.service.ts b/common/src/services/state.service.ts index 3bb26db833..023e7c9bb9 100644 --- a/common/src/services/state.service.ts +++ b/common/src/services/state.service.ts @@ -2425,13 +2425,14 @@ export class StateService< protected removeAccountFromMemory(userId: string = this.state.activeUserId): void { delete this.state.accounts[userId]; + this.accountDiskCache.delete(userId); } protected async pruneInMemoryAccounts() { // 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) { if (!(await this.getIsAuthenticated({ userId: userId }))) { - delete this.state.accounts[userId]; + this.removeAccountFromMemory(userId); } } }