Skip to content

Conversation

@CharlesMassry
Copy link
Collaborator

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

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
@nettofarah
Copy link
Owner

This is beautiful!
I'm in Berlin right now with a pretty spotty internet connection. But I should be able to merge this sometime in the next couple of days

@CharlesMassry
Copy link
Collaborator Author

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

@nettofarah
Copy link
Owner

No worries, @CharlesMassry. I'm gonna check out the branch locally and play with it a bit.
I might push a few extra commits if I run into problems.

Btw, when you said this is the GraphQL standard, did you mean GraphQL or Relay?

@CharlesMassry
Copy link
Collaborator Author

Actually now that I think about it, it looks like the Relay spec, either way the ruby-graphql library supports that

@nettofarah
Copy link
Owner

I'm thinking this is what you meant: https://facebook.github.io/relay/graphql/connections.htm

@CharlesMassry
Copy link
Collaborator Author

Yeah, that's it, also this http://graphql-ruby.org/relay/connections which automatically adds the pageInfo queryable fields

@nettofarah
Copy link
Owner

Perfect. Just wanted to make sure we're talking about the same thing.

@nettofarah
Copy link
Owner

@CharlesMassry: closing this so we can merge our changes together: #4

@nettofarah
Copy link
Owner

Thanks a lot, @CharlesMassry.
Just merged your change.

@nettofarah
Copy link
Owner

Btw, just gave you super powers on this repo! 💪

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