Skip to content

Commit 648fc2a

Browse files
authored
fix(preprint-details): Fix breadcrumbs in preprint (version) (#664)
1 parent f54d5bd commit 648fc2a

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

src/app/features/preprints/pages/preprint-details/preprint-details.component.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ import { Skeleton } from 'primeng/skeleton';
77

88
import { catchError, EMPTY, filter, map, of } from 'rxjs';
99

10-
import { DatePipe, Location } from '@angular/common';
10+
import { DatePipe } from '@angular/common';
1111
import { HttpErrorResponse } from '@angular/common/http';
1212
import {
1313
ChangeDetectionStrategy,
@@ -87,7 +87,6 @@ export class PreprintDetailsComponent implements OnInit, OnDestroy {
8787
private readonly toastService = inject(ToastService);
8888
private readonly router = inject(Router);
8989
private readonly route = inject(ActivatedRoute);
90-
private readonly location = inject(Location);
9190
private readonly store = inject(Store);
9291
private readonly destroyRef = inject(DestroyRef);
9392
private readonly customDialogService = inject(CustomDialogService);
@@ -416,9 +415,10 @@ export class PreprintDetailsComponent implements OnInit, OnDestroy {
416415
const preprintIdFromUrl = urlSegments[urlSegments.length - 1];
417416

418417
if (preprintIdFromUrl !== newPreprintId) {
419-
const newUrl = currentUrl.replace(/[^/]+$/, newPreprintId);
420-
421-
this.location.replaceState(newUrl);
418+
this.router.navigate(['../', newPreprintId], {
419+
relativeTo: this.route,
420+
replaceUrl: true,
421+
});
422422
}
423423
}
424424
}

0 commit comments

Comments
 (0)