Skip to content

Commit

Permalink
Changing search parameters also resets page to 1
Browse files Browse the repository at this point in the history
  • Loading branch information
ommann committed Mar 12, 2024
1 parent 2fef024 commit 3dd3d12
Showing 1 changed file with 10 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -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,
Expand All @@ -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,
Expand Down

0 comments on commit 3dd3d12

Please sign in to comment.