How should we do pagination?
See original GitHub issueHi, Blake.
We have already talked about it a couple of times on Slack. I’m bringing here the topic. Are you doing pagination? How are you doing it?
I’ve been playing with pagination for a while. My implementation was based on Relay-style cursor pagination and written on ember-apollo-client
v0.1.2
. I’ve faced some problems with observable queries and their subscription, so I had to use this.get('apollo.client').watchQuery
to handle observable queries and their subscriptions by hand. I’ve updated ember-apollo-client
to v0.2.2
and now my implementation is broken due to some changes on Apollo Core - but I know what I need to change.
I see, now, that it’s time to stop putting my hands on Apollo Core and use more ApolloService
. Because the things we need to handle on Ember are not straightforward. In exemple, since Apollo Core v0.8.0
, query results are deep frozen, so we need to deep copy the query result to “defrost” it because Ember asks for an extensible object as a model. And ApolloService
already handle this on query
and queryOnce
.
I have an exemple of my old implementation. It’s a little bit outdated since it’s not a production code, but it shows how I play with observable queries and their subscriptions.
I would love to see how do implement pagination. Are you relying on Apollo Core too? Do you think ember-apollo-client
should mirror Apollo Core functions?
Issue Analytics
- State:
- Created 6 years ago
- Comments:9 (8 by maintainers)
Top GitHub Comments
This is fantastic to hear! I’m going to add it to the How to GraphQL tutorial now!
I’m using the
RouteQueryManager
mixin. I haven’t started removing the mixins because there are some symbiotic mixins in the app I’m working on, but it would be great a new strategy without mixins.