BUG: pageInfo erroneously returns hasNextPage: true

I’m getting some unexpected behavior when paginating productVariants sorted by FULL_TITLE but not when sorting by, say, SKU. When getting to the last page of FULL_TITLE results I’m seeing this response where both end and start cursors are the same. And when I use that cursor to try to get the next page, there are no product variants returned. However, when I sort by SKU I get to the last page and hasNextPage is false as expected. Not sure if the sorting is masking some other issue.

Here is the query and inputs:

query ProductVariantsSearch($limit: Int!, $query: String, $cursor: String) {
  productVariants(
    first: $limit
    query: $query
    after: $cursor
    sortKey: FULL_TITLE
  ) {
    edges {
      node {        
        product {
          title
          vendor
        }
        sku
        title
      }
    }
    pageInfo {
      hasNextPage
      endCursor
      hasPreviousPage
      startCursor
    }
  }
}

Inputs

{
  "limit": 3,
  "query": "",
  "cursor": "eyJsYXN0X2lkIjo0MzkxNTAzMDUyODE2MiwibGFzdF92YWx1ZSI6WyJhY29ybiBzcXVhc2giLDgxMzUwNTM5Njc1MjIsNV19"
}

Returns the last item and this pageInfo:

"pageInfo": {
  "hasNextPage": true,
  "endCursor": "eyJsYXN0X2lkIjo0MzkxNTAyNDcyODIyNiwibGFzdF92YWx1ZSI6WyJhbGknaSBrdWxhIGxhdmVuZGVyIGRhcmsgbWlsayBjaG9jb2xhdGUgYmFyIiw4MTM1MDQ4NDk1MjY2LDFdfQ==",
  "hasPreviousPage": true,
  "startCursor": "eyJsYXN0X2lkIjo0MzkxNTAyNDcyODIyNiwibGFzdF92YWx1ZSI6WyJhbGknaSBrdWxhIGxhdmVuZGVyIGRhcmsgbWlsayBjaG9jb2xhdGUgYmFyIiw4MTM1MDQ4NDk1MjY2LDFdfQ=="
}

Then try to get the next page with

{
  "limit": 3,
  "query": "",
  "cursor": "eyJsYXN0X2lkIjo0MzkxNTAyNDcyODIyNiwibGFzdF92YWx1ZSI6WyJhbGknaSBrdWxhIGxhdmVuZGVyIGRhcmsgbWlsayBjaG9jb2xhdGUgYmFyIiw4MTM1MDQ4NDk1MjY2LDFdfQ=="
}

And no product variants are returned.

But it works when sorting by SKU (maybe a red herring).

Hey @RobFarmLink , thanks for sharing this. I’m able to replicate that same behaviour on my end as well with the FULL_TITLE sortkey, so I’ve reached out to our developers to get some more insight on why this is occurring.

I’ll report back here when I have more information!

Thanks,

Kyle G.

Hey again @RobFarmLink , just an update here that our team here is looking in to this. I don’t have a timeframe on a resolution at this time. For now, I would recommend if possible to use TITLE as an alternative.

Thanks again,

Kyle G.

Hey @RobFarmLink ! Following up here, I’ve just heard back from our development team and it looks like the issue has been resolved and can no longer be replicated.

If you notice any reoccurrence, let us know!

  • Kyle G.