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

Reverse pagination: hasPreviousPage and before: and last: #17

Open
simonw opened this issue Aug 4, 2020 · 3 comments
Open

Reverse pagination: hasPreviousPage and before: and last: #17

simonw opened this issue Aug 4, 2020 · 3 comments
Labels
enhancement New feature or request low priority

Comments

@simonw
Copy link
Owner

simonw commented Aug 4, 2020

For the non-alpha release I'm going to support forwards pagination only - after: and endCursor and hasNextPage. I can support startCursor too at this point even though it's not useful for anything yet.

I'll split hasPreviousPage and before: into a separate ticket.
Originally posted by @simonw in #2 (comment)

@simonw
Copy link
Owner Author

simonw commented Aug 4, 2020

This may be blocked by Datasette core support for reverse pagination: simonw/datasette#916 - but I can go ahead and implement this independently and use that implementation to inform a later change to Datasette.

@simonw
Copy link
Owner Author

simonw commented Aug 5, 2020

Worth noting that edge order has some rules in https://relay.dev/graphql/connections.htm#sec-Edge-order

You may order the edges however your business logic dictates, and may determine the ordering based upon additional arguments not covered by this specification. But the ordering must be consistent from page to page, and importantly, The ordering of edges should be the same when using first/after as when using last/before, all other arguments being equal. It should not be reversed when using last/before. More formally:

  • When before: cursor is used, the edge closest to cursor must come last in the result edges.
  • When after: cursor is used, the edge closest to cursor must come first in the result edges.

@simonw simonw changed the title Reverse pagination: hasPreviousPage and before: Reverse pagination: hasPreviousPage and before: and last: Aug 8, 2020
@simonw
Copy link
Owner Author

simonw commented Aug 8, 2020

This is pretty low priority since sort_desc: can be used with first: and after: at the moment.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request low priority
Projects
None yet
Development

No branches or pull requests

1 participant