bryaneaton13 / shadcn-next-link-pagination

Use shadcn pagination components to navigate and update URL params
https://shadcn-next-link-pagination.vercel.app
MIT License
41 stars 3 forks source link

navToPageSize function should reset page size to avoid empty array #2

Open dakShh opened 3 hours ago

dakShh commented 3 hours ago

If there are 10 items in a list and we render it with pageSize 2 we get 5 pages. If we select the 5th page (currentPage = 5) and change the pageSize to 10 we get an empty list since the currentPage is still at 5 and the pageSize is changed to 10 which makes it only one page.

dakShh commented 3 hours ago

Current page = 3 pageSize = 5 image

Current page = 3 pageSize = 10 image