From 422a714935f6ff8487ef8e68f143b6dee6bd715a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Abel=20G=C3=B3mez?= Date: Fri, 14 Mar 2025 01:01:52 +0100 Subject: [PATCH] Check the full URL rather than only the collection id to detect the default path --- .../comcol-page-browse-by.component.ts | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/src/app/shared/comcol/comcol-page-browse-by/comcol-page-browse-by.component.ts b/src/app/shared/comcol/comcol-page-browse-by/comcol-page-browse-by.component.ts index feefb468cb..5b8f12a75d 100644 --- a/src/app/shared/comcol/comcol-page-browse-by/comcol-page-browse-by.component.ts +++ b/src/app/shared/comcol/comcol-page-browse-by/comcol-page-browse-by.component.ts @@ -131,6 +131,13 @@ export class ComcolPageBrowseByComponent implements OnDestroy, OnInit { }), ); + let comColRoute: string; + if (this.contentType === 'collection') { + comColRoute = getCollectionPageRoute(this.id); + } else if (this.contentType === 'community') { + comColRoute = getCommunityPageRoute(this.id); + } + this.subs.push(combineLatest([ this.allOptions$, this.router.events.pipe( @@ -141,15 +148,17 @@ export class ComcolPageBrowseByComponent implements OnDestroy, OnInit { ), ]).subscribe(([navOptions, url]: [ComColPageNavOption[], string]) => { for (const option of navOptions) { - if (url?.split('?')[0].endsWith(`/${this.id}`) && option.id === this.appConfig[this.contentType].defaultBrowseTab) { + if (url?.split('?')[0] === comColRoute && option.id === this.appConfig[this.contentType].defaultBrowseTab) { void this.router.navigate([option.routerLink], { queryParams: option.params }); + break; } else if (option.routerLink === url?.split('?')[0]) { this.currentOption$.next(option); + break; } } })); - if (this.router.url?.split('?')[0].endsWith(`/${this.id}`)) { + if (this.router.url?.split('?')[0] === comColRoute) { this.allOptions$.pipe( take(1), ).subscribe((allOptions: ComColPageNavOption[]) => {