We are having Pagination issues with the new Direct API Access in POS UI Extensions. @Rune-Shopify , is there any chance you could please take a look at this?
Essentially, when we request the next page, the product response only contains 1 single product (which is the last product from the list), instead of the next 30 products.
Thank you for flagging this. We’ve confirmed this is a current issue and our team is actively investigating. In the meantime, a workaround is to make sure you include the cursor field on the product edge since we depend on it for our caching.
Here’s an example of a query that should work:
query($id: ID!, $first: Int!, $after: String) {
collection(id: $id) {
id
title
products(first: $first, after: $after) {
pageInfo {
hasNextPage
endCursor
}
edges {
node {
id
title
handle
priceRangeV2 {
minVariantPrice {
amount
currencyCode
}
}
}
cursor <-- make sure to include this
}
}
}
}
Edit: Pagination using connection edges like the above requires you include the cursor in your query. You can also use forward pagination, which doesn’t require the cursor field.