1
0
mirror of https://github.com/bitwarden/browser synced 2025-12-10 13:23:34 +00:00

[PM-19538] Add shareReplay to internal orgKeys subscription (#14034)

This commit is contained in:
Shane Melton
2025-04-16 08:24:30 -07:00
committed by GitHub
parent b413272bd5
commit f293c15f4d

View File

@@ -1,6 +1,6 @@
// 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 { combineLatest, firstValueFrom, map, Observable, of, switchMap } from "rxjs"; import { combineLatest, firstValueFrom, map, Observable, of, shareReplay, switchMap } from "rxjs";
import { Jsonify } from "type-fest"; import { Jsonify } from "type-fest";
import { EncryptService } from "@bitwarden/common/key-management/crypto/abstractions/encrypt.service"; import { EncryptService } from "@bitwarden/common/key-management/crypto/abstractions/encrypt.service";
@@ -8,10 +8,10 @@ import { I18nService } from "@bitwarden/common/platform/abstractions/i18n.servic
import { Utils } from "@bitwarden/common/platform/misc/utils"; import { Utils } from "@bitwarden/common/platform/misc/utils";
import { import {
ActiveUserState, ActiveUserState,
StateProvider,
COLLECTION_DATA, COLLECTION_DATA,
DeriveDefinition, DeriveDefinition,
DerivedState, DerivedState,
StateProvider,
UserKeyDefinition, UserKeyDefinition,
} from "@bitwarden/common/platform/state"; } from "@bitwarden/common/platform/state";
import { CollectionId, OrganizationId, UserId } from "@bitwarden/common/types/guid"; import { CollectionId, OrganizationId, UserId } from "@bitwarden/common/types/guid";
@@ -84,6 +84,7 @@ export class DefaultCollectionService implements CollectionService {
switchMap(([userId, collectionData]) => switchMap(([userId, collectionData]) =>
combineLatest([of(collectionData), this.keyService.orgKeys$(userId)]), combineLatest([of(collectionData), this.keyService.orgKeys$(userId)]),
), ),
shareReplay({ refCount: false, bufferSize: 1 }),
); );
this.decryptedCollectionDataState = this.stateProvider.getDerived( this.decryptedCollectionDataState = this.stateProvider.getDerived(