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

Starwars connection result is wrong #80

Open
hffmnn opened this issue Dec 12, 2023 · 0 comments
Open

Starwars connection result is wrong #80

hffmnn opened this issue Dec 12, 2023 · 0 comments

Comments

@hffmnn
Copy link

hffmnn commented Dec 12, 2023

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)

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

No branches or pull requests

1 participant