Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: Prevent blank order history page when using new tab component #19543

Open
wants to merge 1 commit into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -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
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This change is not directly related to the issue, but still its better to have this fix as soon as possible, since there is an error in console for b2b

) {
this.subscription.add(
this.pickupOptionCompRef.instance.intendedPickupChange.subscribe(
(
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)),
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

After navigating to different route and back the tabRefs are already initialised with values and this.tabRefs.changes does not emit any value. This change ensures that at least the initial value will be taken into account. This solves the problem

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice find! Are we able to add an e2e test for the empty order history case just to make sure we have coverage?

]).pipe(
map(([components, refs]) =>
components.map((component, index) => ({
headerKey: component.title,
Expand Down
Loading