I have noticed that the search query pagination is incorrect when the number of first element changes.
In the example I have, I make a search query with first: 10, then I use the last cursor with an equal query but first: 20 and the pagination returns the wrong elements in the list. In this specific case, the query has a total of 35 products, however when first parameter changes is like a page is skipped.
The request ID to fetch 50 elements, it correctly returns 35:"
7e9037dc-c74a-4ac6-8717-dfb0868256d4-1783952532
The request ID with first 10 elements, that correctly returns 10 elements:
0deba55a-45e4-43fd-aebd-996cf816b0b4-1783952702
The request ID with first 20 elements, that uses last cursor from the previous request, it only returns 14 elements instead of 20, and is skipping elements:
9ac7d2b9-6f75-404b-b561-a48fad338e17-1783952798
The search query is pretty simple:
query
query SearchProducts(
$searchValue: String!
$sortKey: SearchSortKeys!
$lastCursor: String
$limit: Int!
$unavailableProducts: SearchUnavailableProductsType
$productFilters: [ProductFilter!]
$reverse: Boolean
) {
search(
query: $searchValue
sortKey: $sortKey
after: $lastCursor
first: $limit
types: [PRODUCT]
reverse: $reverse
unavailableProducts: $unavailableProducts
productFilters: $productFilters
) {
pageInfo {
hasNextPage
endCursor,
}
nodes {
... on Product {
id
}
}
totalCount
}
}
Variables used
{
"searchValue": "quad lock",
"lastCursor": null,
"sortKey": "RELEVANCE",
"limit": 10,
"unavailableProducts": "HIDE"
}