-
Notifications
You must be signed in to change notification settings - Fork 58
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
[Apollo Pagination] Improve ReversePagination support, implement loadAll
support, Bidirectional Pagination
#115
Merged
AnthonyMDev
merged 178 commits into
apollographql:main
from
Iron-Ham:hs/reverse-pagination
Jan 24, 2024
Merged
[Apollo Pagination] Improve ReversePagination support, implement loadAll
support, Bidirectional Pagination
#115
AnthonyMDev
merged 178 commits into
apollographql:main
from
Iron-Ham:hs/reverse-pagination
Jan 24, 2024
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
AnthonyMDev
reviewed
Dec 18, 2023
AnthonyMDev
approved these changes
Dec 18, 2023
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Couple of minor things, but this is looking good!
apollo-ios-pagination/Sources/ApolloPagination/AnyGraphQLPager.swift
Outdated
Show resolved
Hide resolved
AnthonyMDev
approved these changes
Dec 18, 2023
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Couple of minor things, but this is looking good!
Iron-Ham
force-pushed
the
hs/reverse-pagination
branch
from
January 8, 2024 18:41
29a1dda
to
86c4885
Compare
BobaFetters
pushed a commit
that referenced
this pull request
Jan 24, 2024
…ort, Bidirectional Pagination (#115)
BobaFetters
pushed a commit
to apollographql/apollo-ios-pagination
that referenced
this pull request
Jan 24, 2024
…ort, Bidirectional Pagination (apollographql/apollo-ios-dev#115)
BobaFetters
pushed a commit
that referenced
this pull request
Jan 24, 2024
9554ce08 [Apollo Pagination] Improve ReversePagination support, implement support, Bidirectional Pagination (#115) git-subtree-dir: apollo-ios-pagination git-subtree-split: 9554ce088caf4097deb1ae6e934ef9d15254a7c7
BobaFetters
pushed a commit
that referenced
this pull request
Jan 24, 2024
…ReversePagination support, implement support, Bidirectional Pagination git-subtree-dir: apollo-ios-pagination git-subtree-mainline: 1e20a27 git-subtree-split: 9554ce088caf4097deb1ae6e934ef9d15254a7c7
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?
GraphQLPager
to be able to load all pages at once, should they desire to do so.closes apollographql/apollo-ios#3265
What approach did you choose and why?
LoadAll Support:
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.Reverse Pagination:
Leaning hard into differentiating reverse and forward pagination from one another.
If we are to support both types of pagination at once, then they must be treated as being separate from one another: A page can be a previous page or it can be a next page. It cannot be both.
BIdirectional Pagination
Once reverse pagination was solidifed, this was a breeze to implement. It basically amounted to defining the pagination struct.
Anything you want to highlight for special attention from reviewers?
Note that the output for the pagination controller is now a struct. This allows us to make changes to the output without breaking previous versions. I've removed logic around
Task
andContinuation
management.If something goes wrong, what are the mitigation strategies?
Copilot Summary
This pull request primarily introduces improvements to the Apollo GraphQL testing suite and pagination functionality. The most significant changes include the addition of a new
BidirectionalPaginationTests
class for testing bidirectional pagination, modifications to theMockGraphQLServer
class to enhance testing capabilities, and updates to theAnyGraphQLQueryPagerTests
andForwardPaginationTests
classes to accommodate new pagination functionalities.Enhancements to Apollo GraphQL testing:
Tests/ApolloInternalTestHelpers/MockGraphQLServer.swift
: Added a private subscript to theMockGraphQLServer
class to handle request expectations for a given operation type. Also, a newexpect
method was added to handle request expectations for a specific operation. [1] [2]Improvements to Apollo GraphQL Pagination:
Tests/ApolloPaginationTests/AnyGraphQLQueryPagerTests.swift
: Modified theeraseToAnyPager
method to include an additional parameter. Also, added a newtest_loadAll
method to test the loading of all pages. Several other minor changes were made to accommodate updates to the pagination functionality. [1] [2] [3] [4]Tests/ApolloPaginationTests/ForwardPaginationTests.swift
: Updated several methods to reflect changes in the pagination functionality. [1] [2] [3] [4] [5]Tests/ApolloPaginationTests/ConcurrencyTest.swift
: Updated several methods to reflect changes in the pagination functionality. [1] [2] [3] [4] [5] [6]Addition of new test class:
Tests/ApolloPaginationTests/BidirectionalPaginationTests.swift
: Added a newBidirectionalPaginationTests
class to test bidirectional pagination functionality. This class includes several methods to test fetching multiple pages, loading all pages, and more.