Skip to content
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] Support queued operations #320

Closed
wants to merge 5 commits into from

Conversation

Iron-Ham
Copy link
Contributor

@Iron-Ham Iron-Ham commented Mar 28, 2024

This is an experimental change which aims to add support for queued operations.
I'm testing this branch in a sample application here.

This change attempts to address the need for secondary triggers in SwiftUI projects, relevant to my comment here: #317 (comment)

For more information, read the README of my sample under the Secondary Triggers known issue.

This pull request adds support for queued operations. Each queued operation is setup such that only one queued operation per set of current data can be executed. If, for example, I call loadNext rapidly three times while nothing is actively loading, the first call will trigger a pagination load, as before. The second call will queue to be executed after the completion of the first call, but will throw a loadInProgress error (as before). The third call will behave as it did before: by only throwing the error. Once the first call is complete, the second pagination fetch will execute.

I am using the current data state to disambiguate these fetches. That does mean that 3 calls to loadNext and 3 calls to loadPrevious will queue both a loadPrevious and a loadNext.


🤖 Copilot Generated 🤖

This pull request primarily focuses on improving the functionality of the AsyncGraphQLQueryPagerCoordinator in the apollo-ios-pagination package. The changes include the introduction of an Operation enum and a queuedOperations property to handle and queue operations, and modifications to the loadNext, loadPrevious, and reset methods to execute these queued operations. Additionally, the paginationFetch method has been updated to handle pagination errors and queue operations accordingly.

Here are the most important changes:

Copy link

netlify bot commented Mar 28, 2024

👷 Deploy request for eclectic-pie-88a2ba pending review.

Visit the deploys page to approve it

Name Link
🔨 Latest commit 06d41e5

Copy link

netlify bot commented Mar 28, 2024

👷 Deploy request for apollo-ios-docc pending review.

Visit the deploys page to approve it

Name Link
🔨 Latest commit 06d41e5

@Iron-Ham Iron-Ham changed the title Support queued operations [ApolloPagination] Support queued operations Mar 28, 2024
@Iron-Ham Iron-Ham closed this Apr 11, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant