-
-
Notifications
You must be signed in to change notification settings - Fork 107
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Pagination API Brainstorm #29
Comments
Whatever you choose, please make it compatible with Elixir's Absinthe.Relay server side implementation. https://github.com/absinthe-graphql/absinthe_relay |
Good idea, I'll use that in my experiments thanks @pzingg :-) |
Closing this for now to reduce noise. I'll refer back to this thread when I consider this issue more. |
Okay, let's give it a go. If i'm staring away too much from Elm philosophy feel free to correct me. So instead of handling nextPage/prevPage/finding the end and the beginning of the cursor inside my model, I'd rather have a function which I can give specific Node to and it will return PaginatedData to me. Considering that it also needs to handle model changes it almost feels like it needs to be a separate subset on Model which would have attributes like hasNextPage/hasPrevPage/isLoading/refetch. Thinking of this a bit more in terms of Elm type safety, do you think it would be possible to generate paginator on the fly when standard relay connection detected? |
Hello @Maxim-Filimonov! Yes, those are along the lines I was thinking as well. I took a working example of pagination and played around with turning it into a nice API that could be generated for APIs that follow the Relay Connections Spec. I'm happy with what I have so far! #113 |
I'm going to close this issue out and let any feedback on my current design happen on #113. Any feedback is welcome there. Thanks! |
I would like to collect use cases and ideas about pagination helpers in
dillonkearns/graphqelm
. I made a simple concrete example that does basic pagination using the Github API:examples/src/GithubPagination.elm
.Here is some reference material:
Facebook's Relay Connections Cursor Specification - this describes the standard format for pagination in GraphQL.
Post from Apollo blog on understanding connections - this explains it in more practical terms.
Apollo has a
fetchMore
function, but it may not be so relevant in the context of Elm because of the very different way of performing side-effects and using types:https://www.apollographql.com/docs/react/recipes/pagination.html
Here's a blog post describing pagination with Apollo.
In my example code at the top of this post, it seems fairly straightforward without any helper functions and it's hard to imagine helper functions making it easier. I may be missing something or not accounting for some use cases, though. I'd love to hear other people's ideas on how pagination could be made simpler with helper functions or generated code.
The text was updated successfully, but these errors were encountered: