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] Add completion callbacks to fetch and refetch in GraphQLQueryPager for API Consistency #292

Merged
merged 2 commits into from
Mar 25, 2024

Conversation

Iron-Ham
Copy link
Contributor

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

For API consistency, it makes sense that both fetch and refetch have completion blocks to indicate when their operations are completed. If we think about the way that the Async variant works, we always have a "completion" signal in the form of the await – whereas we don't for fetch and refetch in the GraphQLQueryPager.


Related: apollographql/apollo-ios#3349


Changes in GraphQLQueryPager.swift:

  • public class GraphQLQueryPager<Model>: Publisher {: The refetch and fetch methods have been updated to include two new parameters: callbackQueue and completion. This allows users to specify a dispatch queue on which the completion callback should be fired and a completion block that triggers after the operation execution.

Changes in GraphQLQueryPagerCoordinator.swift:

  • public protocol PagerType {: The refetch and fetch methods in the PagerType protocol have been updated to include the callbackQueue and completion parameters, aligning with the changes made in the GraphQLQueryPager class.
  • class GraphQLQueryPagerCoordinator<InitialQuery: GraphQLQuery, PaginatedQuery: G: The refetch and fetch methods have been updated to include the callbackQueue and completion parameters. This allows users to specify a dispatch queue on which the completion callback should be fired and a completion block that triggers after the operation execution. [1] [2]

@Iron-Ham Iron-Ham requested a review from a team as a code owner March 9, 2024 00:59
Copy link

netlify bot commented Mar 9, 2024

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

Visit the deploys page to approve it

Name Link
🔨 Latest commit 3e77136

Copy link

netlify bot commented Mar 9, 2024

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

Visit the deploys page to approve it

Name Link
🔨 Latest commit 3e77136

@Iron-Ham Iron-Ham changed the title Add completion callbacks to fetch and refetch in GraphQLQueryPager for API Consistency [ApolloPagination] Add completion callbacks to fetch and refetch in GraphQLQueryPager for API Consistency Mar 11, 2024
Copy link
Contributor

@AnthonyMDev AnthonyMDev left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we need to update the usage docs for this? Maybe we should create a new branch for 0.2 and do this there, so that those docs don't get deployed until we push the 0.2 version release?

@Iron-Ham
Copy link
Contributor Author

Iron-Ham commented Mar 12, 2024

Do we need to update the usage docs for this? Maybe we should create a new branch for 0.2 and do this there, so that those docs don't get deployed until we push the 0.2 version release?

We probably should re-generate the docset, yeah. But since this is a non-breaking change, I can see an argument for a 0.1.1.

EDIT: 0.2.0 is probably the right move, given that there's a PR up with a breaking change: #299

@AnthonyMDev AnthonyMDev merged commit 7ecdd56 into apollographql:main Mar 25, 2024
14 checks passed
BobaFetters pushed a commit that referenced this pull request Mar 25, 2024
BobaFetters pushed a commit to apollographql/apollo-ios-pagination that referenced this pull request Mar 25, 2024
BobaFetters pushed a commit that referenced this pull request Mar 25, 2024
d8ddfdbc [ApolloPagination] Add completion callbacks to fetch and refetch in GraphQLQueryPager for API Consistency (#292)

git-subtree-dir: apollo-ios-pagination
git-subtree-split: d8ddfdbc22d8cd1515a7e8288498e1056850d7f8
BobaFetters pushed a commit that referenced this pull request Mar 25, 2024
…etion callbacks to fetch and refetch in GraphQLQueryPager for API Consistency

git-subtree-dir: apollo-ios-pagination
git-subtree-mainline: e7ee41b
git-subtree-split: d8ddfdbc22d8cd1515a7e8288498e1056850d7f8
@SopheaSao
Copy link

SopheaSao Cambodia Enjoy with you ♥️

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
3 participants