mirror of
https://github.com/bitwarden/browser
synced 2025-12-12 22:33:35 +00:00
PM-3857 - Desktop - App Comp - Refactor order of operations of the logout process to prevent premature process reload before user data can be fully cleaned up out of the state service. Probably fixes PM-3391 as well. (#6616)
This commit is contained in:
@@ -537,6 +537,19 @@ export class AppComponent implements OnInit, OnDestroy {
|
|||||||
this.keyConnectorService.clear(),
|
this.keyConnectorService.clear(),
|
||||||
]);
|
]);
|
||||||
|
|
||||||
|
const preLogoutActiveUserId = this.activeUserId;
|
||||||
|
await this.stateService.clean({ userId: userBeingLoggedOut });
|
||||||
|
|
||||||
|
if (this.activeUserId == null) {
|
||||||
|
this.router.navigate(["login"]);
|
||||||
|
} else if (preLogoutActiveUserId !== this.activeUserId) {
|
||||||
|
this.messagingService.send("switchAccount");
|
||||||
|
}
|
||||||
|
|
||||||
|
await this.updateAppMenu();
|
||||||
|
|
||||||
|
// This must come last otherwise the logout will prematurely trigger
|
||||||
|
// a process reload before all the state service user data can be cleaned up
|
||||||
if (userBeingLoggedOut === this.activeUserId) {
|
if (userBeingLoggedOut === this.activeUserId) {
|
||||||
this.searchService.clearIndex();
|
this.searchService.clearIndex();
|
||||||
this.authService.logOut(async () => {
|
this.authService.logOut(async () => {
|
||||||
@@ -549,17 +562,6 @@ export class AppComponent implements OnInit, OnDestroy {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
const preLogoutActiveUserId = this.activeUserId;
|
|
||||||
await this.stateService.clean({ userId: userBeingLoggedOut });
|
|
||||||
|
|
||||||
if (this.activeUserId == null) {
|
|
||||||
this.router.navigate(["login"]);
|
|
||||||
} else if (preLogoutActiveUserId !== this.activeUserId) {
|
|
||||||
this.messagingService.send("switchAccount");
|
|
||||||
}
|
|
||||||
|
|
||||||
await this.updateAppMenu();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private async recordActivity() {
|
private async recordActivity() {
|
||||||
|
|||||||
Reference in New Issue
Block a user