vercel / nextjs-postgres-nextauth-tailwindcss-template

Admin dashboard template.
https://next-admin-dash.vercel.app/
MIT License
1.08k stars 341 forks source link

Pagination issues #56

Open T04435 opened 2 months ago

T04435 commented 2 months ago

few things:

Happy to update this to shadcn/ui > Pagination

Jakub-Pazio commented 2 months ago

Hi! Not only that, if you search for products with ?q=a, you will get 10 items on the page (all containing the letter 'a'). The reason for this is incorrect logic in the /lib/db.ts file (and some other places). The offset is set incorrectly and currently reflects the offset for future queries instead of the current one. When performing a search with no query, the offset is set to the old offset + 5, but only if the previous offset is not null and greater than 5.

I believe I have solved all the issues You have listed. If possible, could I create a PR for this? 😃

The only question I have is what should be done when searching for a product with an active search? In my fix, I show all items found and hide the bar that displays the number of items and the buttons for switching between pages.