Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Pagination issues #56

Open
T04435 opened this issue Jul 18, 2024 · 1 comment
Open

Pagination issues #56

T04435 opened this issue Jul 18, 2024 · 1 comment

Comments

@T04435
Copy link

T04435 commented Jul 18, 2024

few things:

  • Prev (shouldn't router.back())
  • Prev never disabled
  • if active search ?q=foo the message Showing x-y of z breaks x is negative

Happy to update this to shadcn/ui > Pagination

@T04435 T04435 changed the title Pagination broken Pagination issues Jul 18, 2024
@Jakub-Pazio
Copy link

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants