mirror of
https://github.com/bitwarden/browser
synced 2025-12-06 00:13:28 +00:00
checkpoint on simplified fix before swapping to signals
(cherry picked from commit 551519b7a1)
revert to earlier working commit and add commit to rc
This commit is contained in:
@@ -342,13 +342,25 @@ export class ExportComponent implements OnInit, OnDestroy, AfterViewInit {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private observeFormSelections(): void {
|
private observeFormSelections(): void {
|
||||||
// Set up dynamic format options based on vault selection
|
// Step 1: Update _organizationId$ when vault selection changes
|
||||||
this.formatOptions$ = this.exportForm.controls.vaultSelector.valueChanges.pipe(
|
// In Admin Console context, organizationId is already set via @Input
|
||||||
startWith(this.exportForm.controls.vaultSelector.value),
|
// In Password Manager context, user changes vaultSelector which updates _organizationId$
|
||||||
map((vaultSelection) => {
|
this.exportForm.controls.vaultSelector.valueChanges
|
||||||
const isMyVault = vaultSelection === "myVault";
|
.pipe(takeUntil(this.destroy$))
|
||||||
// Update organizationId based on vault selection
|
.subscribe((vaultSelection) => {
|
||||||
this.organizationId = isMyVault ? undefined : vaultSelection;
|
if (!this.isAdminConsoleContext) {
|
||||||
|
// Password Manager: Update organizationId based on vaultSelector
|
||||||
|
const isMyVault = vaultSelection === "myVault";
|
||||||
|
this.organizationId = isMyVault ? undefined : vaultSelection;
|
||||||
|
}
|
||||||
|
// Admin Console: organizationId is already set via @Input, no update needed
|
||||||
|
});
|
||||||
|
|
||||||
|
// Step 2: Set up dynamic format options based on the organizationId observable
|
||||||
|
// This is the single source of truth for both export contexts
|
||||||
|
this.formatOptions$ = this._organizationId$.pipe(
|
||||||
|
map((organizationId) => {
|
||||||
|
const isMyVault = !organizationId;
|
||||||
return { isMyVault };
|
return { isMyVault };
|
||||||
}),
|
}),
|
||||||
switchMap((options) => this.exportService.formats$(options)),
|
switchMap((options) => this.exportService.formats$(options)),
|
||||||
|
|||||||
Reference in New Issue
Block a user