diff --git a/src/app/fyle/personal-cards/personal-cards.page.spec.ts b/src/app/fyle/personal-cards/personal-cards.page.spec.ts index f5ab98ae12..91e6ba69ce 100644 --- a/src/app/fyle/personal-cards/personal-cards.page.spec.ts +++ b/src/app/fyle/personal-cards/personal-cards.page.spec.ts @@ -1052,32 +1052,6 @@ describe('PersonalCardsPage', () => { expect(component.usePlatformApi).toBeTrue(); }); - it('should call onCardChanged when linkedAccounts$ emits a non-empty value', (done) => { - const subject = new BehaviorSubject([]); - component.linkedAccounts$ = subject.asObservable(); - - component.ngAfterViewInit(); - subject.next(linkedAccountsRes); - - component.linkedAccounts$.subscribe(() => { - expect(component.onCardChanged).toHaveBeenCalledWith(linkedAccountsRes[0].id); - done(); - }); - }); - - it('should not call onCardChanged if linkedAccounts$ emits an empty array', (done) => { - const subject = new BehaviorSubject([]); - component.linkedAccounts$ = subject.asObservable(); - - component.ngAfterViewInit(); - subject.next([]); - - component.linkedAccounts$.subscribe(() => { - expect(component.onCardChanged).not.toHaveBeenCalled(); - done(); - }); - }); - it('should generate filter pills based on filters', () => { personalCardsService.generateFilterPills.and.returnValue(allFilterPills); component.ngAfterViewInit(); diff --git a/src/app/fyle/personal-cards/personal-cards.page.ts b/src/app/fyle/personal-cards/personal-cards.page.ts index 2d3b5ee18b..d9ae01f82d 100644 --- a/src/app/fyle/personal-cards/personal-cards.page.ts +++ b/src/app/fyle/personal-cards/personal-cards.page.ts @@ -282,13 +282,6 @@ export class PersonalCardsPage implements OnInit, AfterViewInit { this.loadAccountCount(); this.loadLinkedAccounts(); - this.linkedAccounts$.pipe(takeUntil(this.onPageExit$)).subscribe((linkedAccounts) => { - if (linkedAccounts.length > 0) { - // Initializing the selectedAccount to First account on page load - this.onCardChanged(linkedAccounts[0].id); - } - }); - const paginatedPipe = this.loadPersonalTxns(); this.transactions$ = paginatedPipe.pipe(shareReplay(1)); this.filterPills = this.personalCardsService.generateFilterPills(this.filters); diff --git a/src/app/shared/components/bank-account-cards/bank-account-cards.component.ts b/src/app/shared/components/bank-account-cards/bank-account-cards.component.ts index 679b3369cc..c321fc0d06 100644 --- a/src/app/shared/components/bank-account-cards/bank-account-cards.component.ts +++ b/src/app/shared/components/bank-account-cards/bank-account-cards.component.ts @@ -33,7 +33,7 @@ export class BankAccountCardsComponent { } onCardChange(event: Swiper[]): void { - if (!this.minimal && event.length && event[0].realIndex && this.linkedAccounts[event[0].realIndex]) { + if (!this.minimal && event.length && event[0].realIndex !== undefined && this.linkedAccounts[event[0].realIndex]) { this.changed.emit(this.linkedAccounts[event[0].realIndex].id); } }