Skip to content

Starwars connection result is wrong #80

@hffmnn

Description

@hffmnn

When running the StarWars example I looked into the pageInfo for humans (There is a total count of 5 humans. ).

Requesting the first 3 gives this (which is correct):

...
"pageInfo": {
        "startCursor": "0",
        "endCursor": "2",
        "hasNextPage": true,
        "hasPreviousPage": false
      }
...

Requesting the next 3 after the first 3 (first:3, after: "2") gives this (which is wrong, hasNextPage should be false)

"pageInfo": {
        "startCursor": "3",
        "endCursor": "4",
        "hasNextPage": true,
        "hasPreviousPage": true
      }

I played around with it a little bit further and found other things:

humans(first: 0, after: "2") gives

"pageInfo": {
        "startCursor": null,
        "endCursor": null,
        "hasNextPage": false, // should be true
        "hasPreviousPage": true
      }

Because the calculation to get the connection data is rather complex and mutativ (if this is a word) I didn't really understand what was going wrong.

🤔 I also wondered if these calculations could get abstracted away somehow (given the total count of items and all the other cursor info as input)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions