Tenant / Guides

Sorting

Sort lists with sortKey and reverse.

Sort a connection

Many connection fields accept sortKey and reverse. The sort key is an enum specific to that field, so follow its linked type to see all valid values.

query Clients($first: Int!, $sortKey: ClientsSortKey!, $reverse: Boolean!) {
clients(first: $first, sortKey: $sortKey, reverse: $reverse) {
edges { node { id name } }
}
}
{
"first": 25,
"sortKey": "ID",
"reverse": true
}

Stable pagination

Keep the same sortKey, direction, and search query while following cursors. Changing the ordering between pages can produce gaps or duplicates.

Sort keys and the default order differ per connection; the reference lists them per operation.