hasNextPage always returning false when first = 30?


#1

Hi!

I was trying out some sample queries with GraphQL to emulate some of my existing REST queries, but I’m having trouble with pagination. It looks like hasNextPage returns false for this query if first is set to exactly 30. Seems like a bug? It seems to work fine if you set it to 29 instead. :slight_smile:

{
  repositoryOwner(login:"github") {
    repositories(first: 30, after: "") {
      edges {
        node {
          name
        }
        cursor
      }
      pageInfo {
        endCursor
        hasNextPage
        hasPreviousPage
      }
    }
  }
}

yields:

{
  "data": {
    "repositoryOwner": {
      "repositories": {
        "edges": [
          {
            "node": {
              "name": "version_sorter"
            },
            "cursor": "MTg0OTk2"
          },
          ...
        ],
        "pageInfo": {
          "endCursor": "NjEzMjY0Mg==",
          "hasNextPage": false,
          "hasPreviousPage": false
        }
      }
    }
  }
}

but the github organization has well over 100 repositories.


#2

Hi @mdelagrange!

Thank you for reporting this and welcome to the Platform Forum! This does seem like a bug, or at the very least, surprising behavior. I’ve opened up an internal issue for us to take a look. We’ll report back once we’ve done some more investigation.

Cheers,
Brooks


#3

This should be fixed now :sparkles:


#4

This topic was automatically closed after 24 hours. New replies are no longer allowed.