Skip to content

Conversation

hestro
Copy link
Member

@hestro hestro commented Nov 15, 2026

This PR adds redirects to page 1 on /books when the page number is beyond the last page, like /profile already does. The search query, filters and sort are kept, and only the page param is removed. This works for both the normal search results and the suggestions shown when a search has no results.

Example:

  • /books?page=999999 redirects to /books
  • A search with no results and a too high page, for example /books?q=lalala&page=99, redirects to page 1 of the suggestions

Closes #133

@hestro hestro added the bug Something isn't working label Nov 15, 2026
@hestro hestro added this to the Deliverable 4 milestone Nov 15, 2026
@hestro hestro self-assigned this Nov 15, 2026
@hestro hestro marked this pull request as ready for review November 15, 2026 14:19
@hestro hestro requested a review from a team as a code owner November 15, 2026 14:19
@johahor
Copy link
Member

johahor commented Nov 16, 2026

Nice fix, and it works exactly as expected.

johahor
johahor previously approved these changes Nov 16, 2026
martakam
martakam previously approved these changes Nov 16, 2026
Copy link
Member

@martakam martakam left a comment

Choose a reason for hiding this comment

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

Values like ?page=abc are treated as the first page, but these values are not removed from the URL automatically. I have created #147 for this

Co-authored-by: Martin Alexander Kaminski <martakam@stud.ntnu.no>

Co-authored-by: Martin Alexander Kaminski <martakam@stud.ntnu.no>
@hestro hestro dismissed stale reviews from martakam and johahor via 8597858 November 16, 2026 10:50
@hestro hestro merged commit 2b348a7 into main Nov 16, 2026
7 checks passed
@martakam martakam deleted the fix/books-invalid-page-redirect 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: redirect from invalid pages to page 1 on books overview page
3 participants