From 687acad07dec9e58b2bc41f8dc029851f2959f23 Mon Sep 17 00:00:00 2001 From: Sergiej Drozd Date: Wed, 13 Nov 2024 23:36:47 +0100 Subject: [PATCH] fix: Prevent blank order history page when using new tab component --- .../components/add-to-cart/add-to-cart.component.ts | 5 ++++- .../src/app/spartacus/spartacus-features.module.ts | 2 +- .../tab-paragraph-container.component.ts | 13 +++++++++++-- 3 files changed, 16 insertions(+), 4 deletions(-) diff --git a/feature-libs/cart/base/components/add-to-cart/add-to-cart.component.ts b/feature-libs/cart/base/components/add-to-cart/add-to-cart.component.ts index 86bcdd15c9d..57b5174108f 100644 --- a/feature-libs/cart/base/components/add-to-cart/add-to-cart.component.ts +++ b/feature-libs/cart/base/components/add-to-cart/add-to-cart.component.ts @@ -244,7 +244,10 @@ export class AddToCartComponent implements OnInit, OnDestroy { } onPickupOptionsCompLoaded() { - if (this.featureConfigService.isEnabled('a11yPickupOptionsTabs')) { + if ( + this.featureConfigService.isEnabled('a11yPickupOptionsTabs') && + this.pickupOptionCompRef instanceof ComponentRef + ) { this.subscription.add( this.pickupOptionCompRef.instance.intendedPickupChange.subscribe( ( diff --git a/projects/storefrontapp/src/app/spartacus/spartacus-features.module.ts b/projects/storefrontapp/src/app/spartacus/spartacus-features.module.ts index 4dedf4b782b..957969b57b7 100644 --- a/projects/storefrontapp/src/app/spartacus/spartacus-features.module.ts +++ b/projects/storefrontapp/src/app/spartacus/spartacus-features.module.ts @@ -353,7 +353,7 @@ if (environment.cpq) { a11yEmptyWishlistHeading: true, a11yScreenReaderBloatFix: true, a11yUseButtonsForBtnLinks: true, - a11yTabComponent: false, + a11yTabComponent: true, a11yCarouselArrowKeysNavigation: true, a11yPickupOptionsTabs: true, a11yNotificationsOnConsentChange: true, diff --git a/projects/storefrontlib/cms-components/content/tab-paragraph-container/tab-paragraph-container.component.ts b/projects/storefrontlib/cms-components/content/tab-paragraph-container/tab-paragraph-container.component.ts index 14d7311e66f..d8a9d72e7d5 100644 --- a/projects/storefrontlib/cms-components/content/tab-paragraph-container/tab-paragraph-container.component.ts +++ b/projects/storefrontlib/cms-components/content/tab-paragraph-container/tab-paragraph-container.component.ts @@ -19,7 +19,13 @@ import { WindowRef, } from '@spartacus/core'; import { BehaviorSubject, combineLatest, Observable } from 'rxjs'; -import { distinctUntilChanged, map, switchMap, tap } from 'rxjs/operators'; +import { + distinctUntilChanged, + map, + startWith, + switchMap, + tap, +} from 'rxjs/operators'; import { ComponentWrapperDirective } from '../../../cms-structure/page/component/component-wrapper.directive'; import { CmsComponentData } from '../../../cms-structure/page/model/index'; import { BREAKPOINT } from '../../../layout/config/layout-config'; @@ -144,7 +150,10 @@ export class TabParagraphContainerComponent implements AfterViewInit, OnInit { } // Render the tabs after the templates have completed loading in the view. - this.tabs$ = combineLatest([this.components$, this.tabRefs.changes]).pipe( + this.tabs$ = combineLatest([ + this.components$, + this.tabRefs.changes.pipe(startWith(this.tabRefs)), + ]).pipe( map(([components, refs]) => components.map((component, index) => ({ headerKey: component.title,