GraphQL Connection for Pagination


#1

Is it possible to use graphql connections for pagination with cursor, hasNextPage properties available? Does anyone have any experience using this?


#2

Have you looked into the Graphcool Relay API? It implements the Relay Cursor Connections Specification, which sounds exactly what you need.


#3

I am sorry but I feel like you didn’t answer the question. I have Product type. _allProductsMeta returns count. I believe that is not enough. Meta resolver should also return whether I can or can’t query next page. Calculating this information client-side is not a good practice.

EDIT: Now I understand your answer. The answer should be more like: No you can't do that. You have to get the pagination information yourself.

Although most people will use skip and first parameters in normal allProducts query.


#4

I disagree. The question was specifically about cursor, hasNextPage and more according to the Relay Cursor Connections specification I shared above.

The Graphcool Relay API exposes Relay-style connections.
In Prisma, there is one API that both exposes simple-style skip and first fields, but also Relay-style connection fields, with the caveat that inner connection fields are added soon.


#5

ok thanks :slight_smile: