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

view.totalPages becomes 1 when current page is out of bounds #107

Open
donaldgray opened this issue Oct 22, 2024 · 1 comment
Open

view.totalPages becomes 1 when current page is out of bounds #107

donaldgray opened this issue Oct 22, 2024 · 1 comment
Assignees
Labels
bug Something isn't working

Comments

@donaldgray
Copy link
Member

donaldgray commented Oct 22, 2024

The totalPages of a hydra view object would previously always show a number of pages in a collection according to the pageSize value.

It appears that this has changed - if the current page is "out of bounds" (e.g there's 10 pages but the page query parameter in the URL is 11) it will be set to 1.

How should this be handled?

Note by @griffri 24/10/2024 - totalItems is also set to 0 when the current page is out of bounds.

@donaldgray donaldgray added the bug Something isn't working label Oct 22, 2024
@p-kaczynski
Copy link
Contributor

Personally I view a request with page out of bounds as a 400 Bad Request. That might be heavy handed, but makes the issue go away, as there would be no response body. For an API user this should be acceptable, for an UI this should not happen in the first place naturally, and is within the UI's wheelhouse to make a correct request instead, e.g. defaulting to page=1.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants