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

Update pagy.rb to handle asking for a page > the last page #264

Closed
wants to merge 1 commit into from

Conversation

weiserma
Copy link

raising an error when what was a good page number is no longer good if a waste of code! Exceptions should only be raised for exceptional conditions no standard processing.

when i first view the page there are 20 tasks... someone else bulk closes 15... now there is only 1 page and a refresh needs to by exception handed.... NO WAY!

raising an error when what was a good page number is no longer good if a waste of code! Exceptions should only be raised for exceptional conditions no standard processing.

when i first view the page there are 20 tasks... someone else bulk closes 15... now there is only 1 page and a refresh needs to by exception handed.... NO WAY!
@weiserma weiserma changed the title Update pagy.rb Update pagy.rb to handle asking for a page > the last page Oct 15, 2020
@ddnexus
Copy link
Owner

ddnexus commented Oct 16, 2020

With your change we would impose a behavior that is not compatible with certain API clients (that stop fetching pages only when they get an empty page). And what if a user would actually want to return page 1 or do anything else instead of getting the last page?

The Overflow extra handles a few common cases (including :last_page), it is compatible also with the countless extra, and does not impose any restriction on the user.

so... "NO WAY!" 😄
Thank you

@ddnexus ddnexus closed this Oct 16, 2020
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 this pull request may close these issues.

None yet

2 participants