-
Notifications
You must be signed in to change notification settings - Fork 10
Add support for pagination #3
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
Conversation
GraphQL spec requires pagination query, which ruby-graphql supports, to be in form of:
query {
vendors(first: 5) {
edges {
node {
id
name
ingredients {
name
quantity
}
}
cursor
}
pageInfo {
endCursor
hasNextPage
hasPreviousPage
startCursor
}
}
}
This fixes that issue, now this commit will remove the N+1 query that was previously present from this GraphQL query
|
This is beautiful! |
|
No worries. Actually I'm a little concerned, it doesn't seem to be working with my project although that could due to my configuration, I'm relatively new to GraphQL |
|
No worries, @CharlesMassry. I'm gonna check out the branch locally and play with it a bit. Btw, when you said this is the GraphQL standard, did you mean GraphQL or Relay? |
|
Actually now that I think about it, it looks like the Relay spec, either way the ruby-graphql library supports that |
|
I'm thinking this is what you meant: https://facebook.github.io/relay/graphql/connections.htm |
|
Yeah, that's it, also this http://graphql-ruby.org/relay/connections which automatically adds the pageInfo queryable fields |
|
Perfect. Just wanted to make sure we're talking about the same thing. |
|
@CharlesMassry: closing this so we can merge our changes together: #4 |
|
Thanks a lot, @CharlesMassry. |
|
Btw, just gave you super powers on this repo! 💪 |
GraphQL spec requires pagination query, which ruby-graphql supports, to be in form of:
This fixes that issue, now this commit will remove the N+1 query that was previously present from this GraphQL query