New pagination bug in GitHub GraphQL: hasNextPage cannot be trusted #30687
-
I just started seeing a weird bug in pagination in the GitHub GraphQL API. Consider the following query: {
viewer {
repositories(first: 10, privacy: PUBLIC) {
totalCount
pageInfo {
hasNextPage
endCursor
}
nodes {
name
}
}
}
} Running this against https://docs.github.com/en/graphql/overview/explorer for me returns: {
"data": {
"viewer": {
"repositories": {
"totalCount": 568,
"pageInfo": {
"hasNextPage": false,
"endCursor": "Y3Vyc29yOnYyOpHOAALtCQ=="
},
"nodes": [
{
"name": "django-debug-toolbar"
},
{
"name": "simonw.github.com"
},
{
"name": "ratelimitcache"
},
{
"name": "api-explorer"
},
{
"name": "python-guardianapi"
},
{
"name": "tweetersation"
},
{
"name": "qypeexplorer"
},
{
"name": "getlatlon.com"
},
{
"name": "django-shorturls"
},
{
"name": "soupselect"
}
]
}
}
}
} Note that it shows a totalCount of 568 - which is correct - but despite only listing the first 10 records it returns This should be This was working fine a few hours ago - I spotted the bug because my Actions workflow that updates my personal profile on https://github.com/simonw suddenly deleted a bunch of my project listings: simonw/simonw@1ed4132 More notes here: |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 14 replies
-
I found a workaround: don't trust the That seems to have fixed the bug I was seeing. |
Beta Was this translation helpful? Give feedback.
-
@simonw Thanks for taking the time to report this bug! It was fixed about a week ago, but I forgot to jump back to this thread and let you know 😓 |
Beta Was this translation helpful? Give feedback.
@simonw Thanks for taking the time to report this bug! It was fixed about a week ago, but I forgot to jump back to this thread and let you know 😓