Skip to content

Conversation

martakam
Copy link
Member

This PR improves our handling of search params in regards to pagination. It also improves loading states.

When it comes to pagination:

  • Invalid page values in the URL, e.g. ?page=abc, are now explicitly redirected, and therefore removed
  • We use one common usePageParam hook to enforce the same max page limit and handling everywhere
  • BookPagination is renamed to ItemPagination, since it is used for reviews too

Changes related to loading states:

  • Previously, if the complete book list was missing, the selectedBook page would not show the book at all. Now, it is enough that we have fetched the book itself, and the browsing buttons will be disabled if needed
  • The selectedBook page only fetches favorites when needed (when someone is logged in and ?origin=favorites)
  • The books page now shows loading skeletons instead of flashing an error when the query changes from exact matches to suggestions. Example to test: Type the query 1984, and then modify it to 19844

Closes #147

@martakam martakam added the bug Something isn't working label Nov 16, 2026
@martakam martakam added this to the Deliverable 4 milestone Nov 16, 2026
@martakam martakam self-assigned this Nov 16, 2026
@martakam martakam requested a review from a team as a code owner November 16, 2026 11:54
Copy link
Member

@hestro hestro left a comment

Choose a reason for hiding this comment

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

Great! This is a very clean solution. I did some testing and everything looks good

@martakam martakam merged commit 67d1014 into main Nov 16, 2026
7 checks passed
@martakam martakam deleted the fix/pagination-and-loading-states branch November 16, 2026 20:05
Sign in to join this conversation on GitHub.
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

fix: remove invalid page params from the URL automatically
2 participants