From 3dd3d12db9cbbe7f3e6f380ad07cd6670da6071d Mon Sep 17 00:00:00 2001 From: Olli Mannevaara Date: Tue, 12 Mar 2024 09:18:36 +0200 Subject: [PATCH] Changing search parameters also resets page to 1 --- .../results/publications2/publications2.component.ts | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/app/portal/components/results/publications2/publications2.component.ts b/src/app/portal/components/results/publications2/publications2.component.ts index 409964423..83de9bfcb 100644 --- a/src/app/portal/components/results/publications2/publications2.component.ts +++ b/src/app/portal/components/results/publications2/publications2.component.ts @@ -496,6 +496,9 @@ export class Publications2Component implements OnDestroy { delete queryParams[key]; } + const page = parseInt(queryParams.page?.[0] ?? "1"); + queryParams.page = [`${page - 1}`]; + this.router.navigate([], { relativeTo: this.route, // skipLocationChange: true, @@ -510,6 +513,9 @@ export class Publications2Component implements OnDestroy { queryParams[key] = [value]; + const page = parseInt(queryParams.page?.[0] ?? "1"); + queryParams.page = [`${page - 1}`]; + this.router.navigate([], { relativeTo: this.route, // skipLocationChange: true, @@ -521,8 +527,12 @@ export class Publications2Component implements OnDestroy { clearParam(key: string) { this.searchParams$.pipe(take(1)).subscribe(filterParams => { const queryParams = { ...filterParams }; + delete queryParams[key]; + const page = parseInt(queryParams.page?.[0] ?? "1"); + queryParams.page = [`${page - 1}`]; + this.router.navigate([], { relativeTo: this.route, // skipLocationChange: true,