A space to discuss GraphQL queries, mutations, troubleshooting, throttling, and best practices.
This is a pretty frustrating one, it seems like it's impossible to paginate results with the GraphQL Partner API.
The `pageInfo.hasNextPage == true` given a specific cursor, yet the response from the query _gives you the same exact cursor in the response_.
This results in a never ending request for the same page and a response referencing the same page.
What's even funnier is the docs themselves seem to reference this exact behavior: https://shopify.dev/api/usage/pagination-graphql
Near the bottom of the page, the query is given an after cursor, yet the example response returns the same exact cursor. How are you supposed to programmatically cycle through pages without a new cursor to use in the response?
Screenshots below taken from the GraphQL docs in question. Notice how the request `after` cursor is defined, yet the response _contains the exact same cursor_
Want to see it in action? Check out our demo store.
Welp, I just didn't read the cursors fully.
The last 4 digits of the cursor string are the same - however on closer inspection they are indeed unique just very very subtlety.
Basically, you have to pop off the last element in the array and retrieve the cursor. Then pass that to the `after` argument.
Jeeze. It's a small detail but they are indeed different. It's embarrassing, but I'm going to leave this up for others to find if they get confused as well as my future self that will most likely forget about this detail.
Want to see it in action? Check out our demo store.
Really glad you left this up. I came here to ask a similar question about the cursor seemingly always coming back the same. After reading your reply I realized I ALSO didn't fully read each cursor. That 2-3 character difference sure hides itself well... 😂