mirror of
https://github.com/bitwarden/browser.git
synced 2024-09-23 03:22:50 +02:00
[PM-12007] Fix vault timeout action logout with account switching (#11008)
* Protect Against Toast Error * Use `concatMap` Instead of `switchMap`
This commit is contained in:
parent
a31ecb18a1
commit
fe96aa85f2
@ -247,7 +247,7 @@ export class AppComponent implements OnInit, OnDestroy {
|
|||||||
// Displaying toasts isn't super useful on the popup due to the reloads we do.
|
// Displaying toasts isn't super useful on the popup due to the reloads we do.
|
||||||
// However, it is visible for a moment on the FF sidebar logout.
|
// However, it is visible for a moment on the FF sidebar logout.
|
||||||
private async displayLogoutReason(logoutReason: LogoutReason) {
|
private async displayLogoutReason(logoutReason: LogoutReason) {
|
||||||
let toastOptions: ToastOptions;
|
let toastOptions: ToastOptions | null = null;
|
||||||
switch (logoutReason) {
|
switch (logoutReason) {
|
||||||
case "invalidSecurityStamp":
|
case "invalidSecurityStamp":
|
||||||
case "sessionExpired": {
|
case "sessionExpired": {
|
||||||
@ -260,6 +260,11 @@ export class AppComponent implements OnInit, OnDestroy {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (toastOptions == null) {
|
||||||
|
// We don't have anything to show for this particular reason
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
this.toastService.showToast(toastOptions);
|
this.toastService.showToast(toastOptions);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
import { combineLatest, filter, firstValueFrom, map, switchMap, timeout } from "rxjs";
|
import { combineLatest, concatMap, filter, firstValueFrom, map, timeout } from "rxjs";
|
||||||
|
|
||||||
import { LogoutReason } from "@bitwarden/auth/common";
|
import { LogoutReason } from "@bitwarden/auth/common";
|
||||||
import { LogService } from "@bitwarden/common/platform/abstractions/log.service";
|
import { LogService } from "@bitwarden/common/platform/abstractions/log.service";
|
||||||
@ -79,7 +79,7 @@ export class VaultTimeoutService implements VaultTimeoutServiceAbstraction {
|
|||||||
this.accountService.activeAccount$,
|
this.accountService.activeAccount$,
|
||||||
this.accountService.accountActivity$,
|
this.accountService.accountActivity$,
|
||||||
]).pipe(
|
]).pipe(
|
||||||
switchMap(async ([activeAccount, accountActivity]) => {
|
concatMap(async ([activeAccount, accountActivity]) => {
|
||||||
const activeUserId = activeAccount?.id;
|
const activeUserId = activeAccount?.id;
|
||||||
for (const userIdString in accountActivity) {
|
for (const userIdString in accountActivity) {
|
||||||
const userId = userIdString as UserId;
|
const userId = userIdString as UserId;
|
||||||
|
Loading…
Reference in New Issue
Block a user