1
0
mirror of https://github.com/bitwarden/browser synced 2025-12-16 08:13:42 +00:00

[PM-19127] - Nested Traverse Optimization (#14881)

* Draft optimization of getNestedCollectionTree

* Added feature flag to wrap nestedTraverse_vNext. added the old implementation back in for feature flagging.

* Correction from CR

* Copied tests over for the vNext method.

---------

Co-authored-by: Thomas Rittson <trittson@bitwarden.com>
This commit is contained in:
Jared McCannon
2025-05-29 11:17:30 -04:00
committed by GitHub
parent 0715597e8e
commit 058eb9a04b
6 changed files with 141 additions and 19 deletions

View File

@@ -125,7 +125,11 @@ import {
BulkCollectionsDialogResult,
} from "./bulk-collections-dialog";
import { CollectionAccessRestrictedComponent } from "./collection-access-restricted.component";
import { getNestedCollectionTree, getFlatCollectionTree } from "./utils";
import {
getNestedCollectionTree,
getFlatCollectionTree,
getNestedCollectionTree_vNext,
} from "./utils";
import { VaultFilterModule } from "./vault-filter/vault-filter.module";
import { VaultHeaderComponent } from "./vault-header/vault-header.component";
@@ -420,9 +424,16 @@ export class VaultComponent implements OnInit, OnDestroy {
}),
);
const nestedCollections$ = allCollections$.pipe(
map((collections) => getNestedCollectionTree(collections)),
shareReplay({ refCount: true, bufferSize: 1 }),
const nestedCollections$ = combineLatest([
this.allCollectionsWithoutUnassigned$,
this.configService.getFeatureFlag$(FeatureFlag.OptimizeNestedTraverseTypescript),
]).pipe(
map(
([collections, shouldOptimize]) =>
(shouldOptimize
? getNestedCollectionTree_vNext(collections)
: getNestedCollectionTree(collections)) as TreeNode<CollectionAdminView>[],
),
);
const collections$ = combineLatest([