-
Notifications
You must be signed in to change notification settings - Fork 55
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
[ApolloPagination] Load All Pages #114
Closed
Closed
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Co-authored-by: Anthony Miller <[email protected]>
…apollo-ios-dev into hs/support-throwing-transforms
This was referenced Oct 31, 2023
Closing in favor of #115 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
What are you trying to accomplish?
Important
This pull request relies on #80, but I cannot point this branch to that branch and attempt to open it up as pull request in this repository (as I'm an unaffiliated contributor to the repository). As such, the overwhelming majority of commits on this branch are not part of this pull request; only the final 4 commits are the contents of this pull request.
I want consumers of the
GraphQLPager
to be able to load all pages at once, should they desire to do so.What approach did you choose and why?
First, I modified the
fetch
function to followasync
/await
syntax. That's so that we canawait
its return prior to beginning to loop overloadMore
.Then, I implemented the function using a while loop.
Finally, I made additive changes to the
MockGraphQLServer
to support subsequent loads of this nature.Anything you want to highlight for special attention from reviewers?
Yes: This doesn't work for ReversePagination -- and that's okay. ReversePagination is due for some re-working as part of apollographql/apollo-ios#3265
If something goes wrong, what are the mitigation strategies?
🤖 Generated by Copilot at 12d13bc
Summary
🧪🔄🔒
This pull request adds a new feature to the
GraphQLQueryPager
protocol and class, which allows loading all the pages of a paginated GraphQL query in one call. It also updates the tests and the mock GraphQL server to use the new feature and the async/await syntax. Additionally, it removes some unnecessary public modifiers from internal extensions.Walkthrough
loadAll
methods toAnyGraphQLPager
andGraphQLQueryPager
protocols and classes to allow loading all pages of a paginated query in one callGraphQLQueryPager.Actor
class to use async/await syntax,initialFetchTask
property, andisLoadingAll
flag for pagination logic and cancellation handlingAnyGraphQLQueryPager
andForwardPaginationTests
using mock GraphQL server and expectationsMockGraphQLServer
class to access and setRequestExpectation
objects for different operation typesFriendsQuery
extension methods to use specific query instances with expected variables instead of generic operation typepublic
modifiers fromGraphQLQueryPager.Actor
extensions inAnyGraphQLPager.swift
andPager+Convenience.swift
filespublic
modifier from initializer inGraphQLQueryPager
classFriendsQuery+TestHelpers.swift
file