From d0f0f89ab98fcf4f7148caad082fde501b1ca5a8 Mon Sep 17 00:00:00 2001 From: SK027 Date: Wed, 5 Jun 2024 13:54:39 +0530 Subject: [PATCH] fix: breaking edit expense page (#3053) --- .../add-edit-expense/add-edit-expense.page.ts | 18 ++++++------------ 1 file changed, 6 insertions(+), 12 deletions(-) diff --git a/src/app/fyle/add-edit-expense/add-edit-expense.page.ts b/src/app/fyle/add-edit-expense/add-edit-expense.page.ts index 1a13ad80f9..486fb66715 100644 --- a/src/app/fyle/add-edit-expense/add-edit-expense.page.ts +++ b/src/app/fyle/add-edit-expense/add-edit-expense.page.ts @@ -2538,18 +2538,12 @@ export class AddEditExpensePage implements OnInit { }; }; - this.filteredCategories$ = this.etxn$.pipe( - switchMap((etxn) => { - if (etxn.tx.project_id) { - return this.activeCategories$.pipe( - map((allActiveCategories) => this.projectsService.getbyId(etxn.tx.project_id, allActiveCategories)) - ); - } else if (projectControl?.value?.project_id) { - return this.activeCategories$.pipe( - map((allActiveCategories) => - this.projectsService.getbyId(projectControl.value.project_id, allActiveCategories) - ) - ); + const projectId$ = this.etxn$.pipe(map((etxn) => etxn.tx.project_id || projectControl?.value?.project_id)); + + this.filteredCategories$ = combineLatest([projectId$, this.activeCategories$]).pipe( + switchMap(([projectId, allActiveCategories]) => { + if (projectId) { + return this.projectsService.getbyId(projectId, allActiveCategories); } else { return of(null); }