From 818a32b30b1af047d0de319b1c3015616fcff13e Mon Sep 17 00:00:00 2001 From: skoch-intershop <62150160+skoch-intershop@users.noreply.github.com> Date: Thu, 1 Aug 2024 14:49:18 +0200 Subject: [PATCH] fix: change facade method for eligible address determination (#1701) --- src/app/core/facades/checkout.facade.ts | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/app/core/facades/checkout.facade.ts b/src/app/core/facades/checkout.facade.ts index ef4f7b3cd6..643fb43941 100644 --- a/src/app/core/facades/checkout.facade.ts +++ b/src/app/core/facades/checkout.facade.ts @@ -2,7 +2,7 @@ import { Injectable } from '@angular/core'; import { Store, createSelector, select } from '@ngrx/store'; import { formatISO } from 'date-fns'; import { Subject, combineLatest, merge } from 'rxjs'; -import { debounceTime, distinctUntilChanged, map, sample, switchMap, take, tap } from 'rxjs/operators'; +import { debounceTime, distinctUntilChanged, filter, map, sample, switchMap, take, tap } from 'rxjs/operators'; import { Address } from 'ish-core/models/address/address.model'; import { Attribute } from 'ish-core/models/attribute/attribute.model'; @@ -300,9 +300,14 @@ export class CheckoutFacade { ) ); + /** + * Determines the eligible addresses of baskets that have an invoice address. + * This ensures that the basket has at least one address. + */ eligibleAddresses$() { return this.basket$.pipe( whenTruthy(), + filter(basket => basket.invoiceToAddress !== undefined), take(1), tap(() => this.store.dispatch(loadBasketEligibleAddresses())), switchMap(() => this.store.pipe(select(getBasketEligibleAddresses)))