Skip to content

Commit

Permalink
fix: breaking edit expense page (#3053)
Browse files Browse the repository at this point in the history
  • Loading branch information
SahilK-027 authored Jun 5, 2024
1 parent 3862c7d commit 6f9540f
Showing 1 changed file with 6 additions and 12 deletions.
18 changes: 6 additions & 12 deletions src/app/fyle/add-edit-expense/add-edit-expense.page.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
Expand Down

0 comments on commit 6f9540f

Please sign in to comment.