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

fix(connectionPlugin): allow first and last to be zero #436

Conversation

leonardodino
Copy link
Contributor

@leonardodino leonardodino commented May 10, 2020

according to the GraphQL Cursor Connections Specification

4.1 Forward pagination arguments

first takes a non‐negative integer.

4.2 Backward pagination arguments

last takes a non‐negative integer.

edit: here's a quick example in the wild


the patch presented here was done in a quick way to satisfy the spec,
I'm very open to feedback or improvements from the team 😄

@leonardodino
Copy link
Contributor Author

This seems to not make much sense on it's own, but it's actually really nice for counting edges with totalCount extension in the connection.

right now, as a workaround, I'm using first: 1.

Would be cool to see this merged 🙌

Copy link
Contributor

@jasonkuhrt jasonkuhrt left a comment

Choose a reason for hiding this comment

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

Thanks @leonardodino this looks harmless and spec compliant. Let's try it.

@jasonkuhrt jasonkuhrt merged commit 5b900b1 into graphql-nexus:develop Jul 1, 2020
@leonardodino leonardodino deleted the allow-zero-first-last-connection branch July 5, 2020 02:09
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.

2 participants