Skip to content

Commit

Permalink
fix: Prevent blank order history page when using new tab component
Browse files Browse the repository at this point in the history
  • Loading branch information
sdrozdsap committed Nov 13, 2024
1 parent ff6ce9f commit 06eac48
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 16 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -245,19 +245,22 @@ export class AddToCartComponent implements OnInit, OnDestroy {

onPickupOptionsCompLoaded() {
if (this.featureConfigService.isEnabled('a11yPickupOptionsTabs')) {
this.subscription.add(
this.pickupOptionCompRef.instance.intendedPickupChange.subscribe(
(
intendedPickupLocation:
| { pickupOption?: 'pickup' | 'delivery'; displayName?: string }
| undefined
) => {
this.disabled =
intendedPickupLocation?.pickupOption === 'pickup' &&
!intendedPickupLocation.displayName;
}
)
);
// Nesting this `if` statement for keeping feature flag check separately for easier removing
if (this.pickupOptionCompRef instanceof ComponentRef) {
this.subscription.add(
this.pickupOptionCompRef.instance.intendedPickupChange.subscribe(
(
intendedPickupLocation:
| { pickupOption?: 'pickup' | 'delivery'; displayName?: string }
| undefined
) => {
this.disabled =
intendedPickupLocation?.pickupOption === 'pickup' &&
!intendedPickupLocation.displayName;
}
)
);
}
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -353,7 +353,7 @@ if (environment.cpq) {
a11yEmptyWishlistHeading: true,
a11yScreenReaderBloatFix: true,
a11yUseButtonsForBtnLinks: true,
a11yTabComponent: false,
a11yTabComponent: true,
a11yCarouselArrowKeysNavigation: true,
a11yPickupOptionsTabs: true,
a11yNotificationsOnConsentChange: true,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand Down Expand Up @@ -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,
Expand Down

0 comments on commit 06eac48

Please sign in to comment.