You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
At GitHub, we have a use-case where we often drop users into the middle of a paginated list. For example, when you tap a notification to an issue that you've been mentioned in, we will load the body of the issue, and we will begin forward pagination with the cursor of the specific comment you were mentioned in. If there are previous elements, we will append a ("Load n other items") button in the timeline.
We want to be able to paginate forward if the user scrolls down
We want to be able to reverse paginate if the user taps the button.
Describe the solution you'd like
My gut says that this is an additional function to the GraphQLPager API: loadPrevious that should only be available if InitialQuery == PaginatedQuery. Assuming that to be the case, when we successfully loadPrevious, we should shift everything left: what was the initial result should now be the new result, and the initial result should be made the first element of the next-page-results array.
This may involve a change for reverse pagination such that reverse-pagination based strategies would have to rely on loadPrevious (or, a different loadPrevious -- realistically in the event of InitialQuery being different than PaginatedQuery for a reverse paginated API, the "initial query" is just the last page of data).
Something to think on. I'll be working on this starting Monday, but won't be including it as part of the open pull request -- I'm worried it'll be far too hard to review at that point, as it's already a bit large.
The text was updated successfully, but these errors were encountered:
Do you have any feedback for the maintainers? Please tell us by taking a one-minute survey. Your responses will help us understand Apollo iOS usage and allow us to serve you better.
Use case
After merging apollographql/apollo-ios-dev#80, I'll be tackling building out bi-directional pager support.
Concretely:
Describe the solution you'd like
My gut says that this is an additional function to the
GraphQLPager
API:loadPrevious
that should only be available ifInitialQuery == PaginatedQuery
. Assuming that to be the case, when we successfullyloadPrevious
, we should shift everything left: what was the initial result should now be the new result, and the initial result should be made the first element of the next-page-results array.This may involve a change for reverse pagination such that reverse-pagination based strategies would have to rely on
loadPrevious
(or, a differentloadPrevious
-- realistically in the event ofInitialQuery
being different thanPaginatedQuery
for a reverse paginated API, the "initial query" is just the last page of data).Something to think on. I'll be working on this starting Monday, but won't be including it as part of the open pull request -- I'm worried it'll be far too hard to review at that point, as it's already a bit large.
The text was updated successfully, but these errors were encountered: