Discussing APIs and development related to customers, discounts, and order management.
Hi there
I am pulling open orders. I am doing more work but have slimmed this down to show the issue. I am using the latest release API.
query ($numRows: Int!, $cursor: String) {
orders(first: $numRows, query: "fulfillment_status:unfulfilled status:open", after: $cursor) {
edges {
cursor
node {
closed
legacyResourceId
displayFulfillmentStatus
name
customer {
displayName
}
}
}
pageInfo {
hasNextPage
}
}
variables are like so for the first pull:
{
"numRows": 20
}
I get a set of data. Then I set the cursor to be the last row of my output. 60 or so rows in, I am getting a duplicate.
{
"numRows":20,
"cursor": "eyJsYXN0X2lkIjoyNDYxNDI3NTMxODM4LCJsYXN0X3ZhbHVlIjoiMjAyMC0wNy0wNSAyMzoyMjowNiJ9"
}
It seems the after operator is allowing this value to appear as the first row in the next set. I would think after means > and not >=. It's strange, the value of the cursor when used on other things neatly steps me through and never duplicates. With this query it is duplicating this one set. I can see no reason for its duplication in the data. I guess this can possibly be an artifact in the data itself but I would expect that when I use after (like with products) the values is truly after the cursor and not including the value of the cursor itself. The sample on this page for products works as expected: https://shopify.dev/concepts/graphql/pagination but mine glitches on this one order.
Hey @dma550,
There was a similar issue with GraphQL cursors around this time frame that our devs have since pushed a fix for. Can you confirm if you're still seeing the issue?
JB | Solutions Engineer @ Shopify
- Was your question answered? Mark it as an Accepted Solution
- To learn more visit Shopify.dev or the Shopify Web Design and Development Blog