PageInfo
PageInfo provides cursor-based pagination metadata returned by all connection types. See How Pagination Works for a full explanation.
Fields
| Field | Type | Description |
|---|---|---|
startCursor | String | Cursor of the first item (for paginating backward) |
endCursor | String | Cursor of the last item (for paginating forward) |
hasNextPage | Boolean! | Whether more items exist after the last item |
hasPreviousPage | Boolean! | Whether more items exist before the first item |
Example
query PaginatedDocuments {
group(id: "Z3JwbGVnYWxlc2lnbxRldg==") {
documentConnection(first: 25) {
documents {
id
name
}
pageInfo {
endCursor
hasNextPage
}
totalCount
}
}
}
To fetch the next page, pass endCursor as the after argument:
query NextPage {
group(id: "Z3JwbGVnYWxlc2lnbxRldg==") {
documentConnection(first: 25, after: "Y3Vyc29yOjI1") {
documents {
id
name
}
pageInfo {
endCursor
hasNextPage
}
}
}
}
Related
- How Pagination Works — full explanation of the connection pattern