Hi, I am so confuse with Cursor to make a pagination...
I have a query products like this
query GET_PRODUCTS($first: Int, $before: String, $after: String, $last: Int) {
products(first: $first, before: $before, after: $after, last: $last) {
nodes {
name
slug
databaseId
}
pageInfo {
endCursor
hasNextPage
hasPreviousPage
startCursor
}
}
}
I will have list of products and pageInfo like this
"pageInfo": {
"endCursor": "YXJyYXljb25uZWN0aW9uOjIyMjA=",
"hasNextPage": true,
"hasPreviousPage": false,
"startCursor": "YXJyYXljb25uZWN0aW9uOjIyMzg="
}
Then if I want get list of next 10 products I will use input like this?
{
"first": 10 ,
"after": endCursorStringAbove
}
I tried but I will return me
"pageInfo": {
"endCursor": null,
"hasNextPage": true,
"hasPreviousPage": true,
"startCursor": null
}
I don't understand how this work :(
:| Oki I got how it work
The first input need increase too. Why do you make this so confuse. Why dont use skip ?
I'm having the same issue. I got it to work using the same way you mentioned (by increasing the first input). Feels very hacky. When querying posts you don't have to worry about updating the first input.
@IRediTOTO @scottyzen Due to a recent change in WPGraphQL there is a bug in pagination that will be resolve in the next release v0.10.0.
This issue is a duplicate of #474
Is there any other way to paginate that could be used for now until the cursor pagination is fixed? Not sure...maybe the traditional one with the numbers of pages, like google?
Most helpful comment
@IRediTOTO @scottyzen Due to a recent change in WPGraphQL there is a bug in pagination that will be resolve in the next release v0.10.0.
This issue is a duplicate of #474