Skip to content

Commit

Permalink
Update list pagination routing behaviour (#50)
Browse files Browse the repository at this point in the history
  • Loading branch information
WenInCode committed Aug 25, 2023
1 parent 2c5af5f commit 63f6893
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
6 changes: 6 additions & 0 deletions .changeset/nasty-shoes-repair.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
'@hashicorp/consul-ui-toolkit': major
---

Update pagination pagesize handler to always specify the current route when transitioning
Update pagination routing to set separate query params for next or prev page
5 changes: 3 additions & 2 deletions toolkit/src/components/cut/list/pagination.ts
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,8 @@ export default class PaginationComponent extends Component<PaginationSignature>

return (page) =>
Object.assign({}, queryParams, {
page: page === 'prev' ? this.args.prevCursor : this.args.nextCursor,
previousPage: page === 'prev' ? this.args.prevCursor : undefined,
nextPage: page === 'next' ? this.args.nextCursor : undefined,
});
}
}
Expand All @@ -67,7 +68,7 @@ export default class PaginationComponent extends Component<PaginationSignature>
pageSize: size,
});

this.router.transitionTo({
this.router.transitionTo(this.router.currentRouteName, {
queryParams: newParams,
});
}
Expand Down

1 comment on commit 63f6893

@vercel
Copy link

@vercel vercel bot commented on 63f6893 Aug 25, 2023

Choose a reason for hiding this comment

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

Please sign in to comment.