mirror of
https://github.com/bitwarden/browser
synced 2025-12-12 14:23:32 +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
|
// FIXME: Update this file to be type safe and remove this and next line
|
||||||
// @ts-strict-ignore
|
// @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.
|
// 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
|
// eslint-disable-next-line no-restricted-imports
|
||||||
@@ -69,8 +79,12 @@ export class FolderService implements InternalFolderServiceAbstraction {
|
|||||||
|
|
||||||
const observable = merge(
|
const observable = merge(
|
||||||
this.forceFolderViews[userId],
|
this.forceFolderViews[userId],
|
||||||
this.encryptedFoldersState(userId).state$.pipe(
|
combineLatest([
|
||||||
switchMap((folderData) => {
|
this.encryptedFoldersState(userId).state$,
|
||||||
|
this.keyService.userKey$(userId),
|
||||||
|
]).pipe(
|
||||||
|
filter(([folderData, userKey]) => folderData != null && userKey != null),
|
||||||
|
switchMap(([folderData, _]) => {
|
||||||
return this.decryptFolders(userId, folderData);
|
return this.decryptFolders(userId, folderData);
|
||||||
}),
|
}),
|
||||||
),
|
),
|
||||||
|
|||||||
Reference in New Issue
Block a user