-
Notifications
You must be signed in to change notification settings - Fork 61
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
usage docs
#262
Changes from all commits
557bea7
4e776ea
ede7488
103aefc
1a1a273
3bc1675
8ba1d79
644649e
e7c1b00
30529e8
f1cae88
0786446
fee7e30
bb153dd
750183a
87f0f9e
2cbab20
d72e23c
fb1fcff
0a56b1a
167544b
f9c9d05
5aee925
e220678
321bf95
40a6414
fe66eec
bdc33be
dc5fc9e
c101fbf
2581199
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -10,7 +10,7 @@ public extension GraphQLQueryPager { | |
client: ApolloClientProtocol, | ||
watcherDispatchQueue: DispatchQueue = .main, | ||
initialQuery: InitialQuery, | ||
pageResolver: @escaping (P, PaginationDirection) -> InitialQuery, | ||
pageResolver: @escaping (P, PaginationDirection) -> InitialQuery?, | ||
extractPageInfo: @escaping (InitialQuery.Data) -> P | ||
) -> GraphQLQueryPager where Model == PaginationOutput<InitialQuery, InitialQuery> { | ||
GraphQLQueryPager(pager: GraphQLQueryPagerCoordinator( | ||
|
@@ -27,7 +27,7 @@ public extension GraphQLQueryPager { | |
client: ApolloClientProtocol, | ||
watcherDispatchQueue: DispatchQueue = .main, | ||
initialQuery: InitialQuery, | ||
pageResolver: @escaping (P, PaginationDirection) -> InitialQuery, | ||
pageResolver: @escaping (P, PaginationDirection) -> InitialQuery?, | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @AnthonyMDev I can pull this out of this PR if you prefer and into a second – but I noticed that the There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Nah, that's fine! |
||
extractPageInfo: @escaping (InitialQuery.Data) -> P, | ||
transform: @escaping ([InitialQuery.Data], InitialQuery.Data, [InitialQuery.Data]) throws -> Model | ||
) -> GraphQLQueryPager { | ||
|
@@ -48,7 +48,7 @@ public extension GraphQLQueryPager { | |
client: ApolloClientProtocol, | ||
watcherDispatchQueue: DispatchQueue = .main, | ||
initialQuery: InitialQuery, | ||
pageResolver: @escaping (P, PaginationDirection) -> InitialQuery, | ||
pageResolver: @escaping (P, PaginationDirection) -> InitialQuery?, | ||
extractPageInfo: @escaping (InitialQuery.Data) -> P, | ||
transform: @escaping (InitialQuery.Data) throws -> Model | ||
) -> GraphQLQueryPager where Model: RangeReplaceableCollection, T == Model.Element { | ||
|
@@ -72,7 +72,7 @@ public extension GraphQLQueryPager { | |
watcherDispatchQueue: DispatchQueue = .main, | ||
extractInitialPageInfo: @escaping (InitialQuery.Data) -> P, | ||
extractNextPageInfo: @escaping (PaginatedQuery.Data) -> P, | ||
pageResolver: @escaping (P, PaginationDirection) -> PaginatedQuery | ||
pageResolver: @escaping (P, PaginationDirection) -> PaginatedQuery? | ||
) -> GraphQLQueryPager where Model == PaginationOutput<InitialQuery, PaginatedQuery> { | ||
GraphQLQueryPager( | ||
pager: .init( | ||
|
@@ -95,7 +95,7 @@ public extension GraphQLQueryPager { | |
watcherDispatchQueue: DispatchQueue = .main, | ||
extractInitialPageInfo: @escaping (InitialQuery.Data) -> P, | ||
extractNextPageInfo: @escaping (PaginatedQuery.Data) -> P, | ||
pageResolver: @escaping (P, PaginationDirection) -> PaginatedQuery, | ||
pageResolver: @escaping (P, PaginationDirection) -> PaginatedQuery?, | ||
transform: @escaping ([PaginatedQuery.Data], InitialQuery.Data, [PaginatedQuery.Data]) throws -> Model | ||
) -> GraphQLQueryPager where Model == PaginationOutput<InitialQuery, PaginatedQuery> { | ||
GraphQLQueryPager( | ||
|
@@ -120,7 +120,7 @@ public extension GraphQLQueryPager { | |
watcherDispatchQueue: DispatchQueue = .main, | ||
extractInitialPageInfo: @escaping (InitialQuery.Data) -> P, | ||
extractNextPageInfo: @escaping (PaginatedQuery.Data) -> P, | ||
pageResolver: @escaping (P, PaginationDirection) -> PaginatedQuery, | ||
pageResolver: @escaping (P, PaginationDirection) -> PaginatedQuery?, | ||
initialTransform: @escaping (InitialQuery.Data) throws -> Model, | ||
pageTransform: @escaping (PaginatedQuery.Data) throws -> Model | ||
) -> GraphQLQueryPager where Model: RangeReplaceableCollection, T == Model.Element { | ||
|
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.
Do we need to update unit tests for this? Can also be done in a separate PR later.
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.
I think that'd be wise, yes.
As written, I think this would require us to re-init a new pager – in the same sense that cancelling a
watcher
stops it from being used again.