diff --git a/apps/client/src/app/pages/accounts/create-or-update-account-dialog/create-or-update-account-dialog.component.ts b/apps/client/src/app/pages/accounts/create-or-update-account-dialog/create-or-update-account-dialog.component.ts index 83fad091e..ceb11a011 100644 --- a/apps/client/src/app/pages/accounts/create-or-update-account-dialog/create-or-update-account-dialog.component.ts +++ b/apps/client/src/app/pages/accounts/create-or-update-account-dialog/create-or-update-account-dialog.component.ts @@ -81,22 +81,23 @@ export class GfCreateOrUpdateAccountDialogComponent implements OnDestroy { currency: [this.data.account.currency, Validators.required], isExcluded: [this.data.account.isExcluded], name: [this.data.account.name, Validators.required], - platformId: [null, this.autocompleteObjectValidator()] // Initialize as null + platformId: [null, this.autocompleteObjectValidator()] }); this.dataService.fetchPlatforms().subscribe(({ platforms }) => { this.platforms = platforms; - // Update platformId after platforms are loaded const selectedPlatform = this.platforms.find(({ id }) => { return id === this.data.account.platformId; }); - this.accountForm.patchValue({ - platformId: selectedPlatform - }); + this.accountForm.patchValue( + { + platformId: selectedPlatform + }, + { emitEvent: false } + ); - // Set up filteredPlatforms observable this.filteredPlatforms = this.accountForm .get('platformId') .valueChanges.pipe( diff --git a/apps/client/src/app/services/data.service.ts b/apps/client/src/app/services/data.service.ts index 2cda1d475..21eec06c3 100644 --- a/apps/client/src/app/services/data.service.ts +++ b/apps/client/src/app/services/data.service.ts @@ -198,10 +198,6 @@ export class DataService { ); } - public fetchPlatforms(): Observable { - return this.http.get('/api/v1/platforms'); - } - public fetchAccounts({ filters }: { filters?: Filter[] } = {}) { const params = this.buildFiltersAsQueryParams({ filters }); @@ -526,6 +522,10 @@ export class DataService { ); } + public fetchPlatforms() { + return this.http.get('/api/v1/platforms'); + } + public fetchPortfolioDetails({ filters, withMarkets = false