mirror of
https://github.com/bitwarden/browser
synced 2025-12-06 00:13:28 +00:00
Add filter to wait for user key availabilty before decrypting folders (#15645)
This commit is contained in:
@@ -1,6 +1,16 @@
|
||||
// FIXME: Update this file to be type safe and remove this and next line
|
||||
// @ts-strict-ignore
|
||||
import { Observable, Subject, firstValueFrom, map, shareReplay, switchMap, merge } from "rxjs";
|
||||
import {
|
||||
Observable,
|
||||
Subject,
|
||||
firstValueFrom,
|
||||
map,
|
||||
shareReplay,
|
||||
switchMap,
|
||||
merge,
|
||||
filter,
|
||||
combineLatest,
|
||||
} from "rxjs";
|
||||
|
||||
// This import has been flagged as unallowed for this class. It may be involved in a circular dependency loop.
|
||||
// eslint-disable-next-line no-restricted-imports
|
||||
@@ -69,8 +79,12 @@ export class FolderService implements InternalFolderServiceAbstraction {
|
||||
|
||||
const observable = merge(
|
||||
this.forceFolderViews[userId],
|
||||
this.encryptedFoldersState(userId).state$.pipe(
|
||||
switchMap((folderData) => {
|
||||
combineLatest([
|
||||
this.encryptedFoldersState(userId).state$,
|
||||
this.keyService.userKey$(userId),
|
||||
]).pipe(
|
||||
filter(([folderData, userKey]) => folderData != null && userKey != null),
|
||||
switchMap(([folderData, _]) => {
|
||||
return this.decryptFolders(userId, folderData);
|
||||
}),
|
||||
),
|
||||
|
||||
Reference in New Issue
Block a user