Enhancements to pagination for GraphQL connections
API
Effective April 01, 2022
In addition to edges
, GraphQL connections now have a nodes
field. When you only query node
on edges
, you can simplify the query.
For example:
{ connection { edges { node { fields } } }
can be simplified to:
{ connection { nodes { fields } } }
PageInfo
has been expanded as well to include startCursor
and endCursor
.
When these fields are used in tandem, it can simplify the shape of return data for pagination.
Previous query format:
{ connection { edges { cursor node { fields } } pageInfo { hasNextPage } } }
Improved query format:
{ connection { nodes { fields } pageInfo { hasNextPage endCursor } } }