DEV Community

Discussion on: GraphQL pagination

Collapse
 
gugadev profile image
Gustavo Garsaky

I think the best and performant way to do this is through cursors. Making pagination at client side doesn't have so much sense due the nature of GraphQL of get only the data that you need. There is no the best overall solution when we talk about this topic, you should pick the best way that works for you.

Collapse
 
danroc profile image
Daniel da Rocha

It seems like an interesting paradox: while you only get the data you need, you end up calling the server more times with specific requests?

Collapse
 
gugadev profile image
Gustavo Garsaky

Of course, yes. However, it doesn't matter. Always bet on small chunks of data when you need it instead one big request. It's a good practice for web performance and UX. You could make a single request for thousand of records and process it inside a worker but the negative impact on slows networks still there.