You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Would like get to have function to get a Flow of all pages from a paginated query.
Describe the solution you'd like
Add something like the flowFromPaginatedQuery function below.
Provide extractCursorFromResponse that describe how to get the cursor out of the response.
And provide queryFactory that describes how to construct a new query given a cursor.
This could be convenient but could also be a bit dangerous as this will potentially make a lot of network requests in a loop if there are many pages. For this maybe we could add some kind of a limit parameter, but overall this also feels a bit too specific to reside in the library and since it is only a few lines I think it's OK to keep it in your project?
On a related note, we are looking at improving pagination scenarios related to the Normalized Cache, if you're interested you can monitor issue #3807.
Hi! Sorry for the long delay! I think for now a separate artifact would be overkill but we could add this to the main artifact (apollo-runtime) as an @ApolloExperimental method. Do you want to open a PR for it?
Hi 👋 We've decided to not implement this for now as it can be done at the callsite. If anyone feels strongly this should be included by default, feel free to send a pull request.
Use case
Would like get to have function to get a
Flow
of all pages from a paginated query.Describe the solution you'd like
Add something like the
flowFromPaginatedQuery
function below.Provide
extractCursorFromResponse
that describe how to get the cursor out of the response.And provide
queryFactory
that describes how to construct a new query given a cursor.Using the example from the tutorial you would do something like this:
The text was updated successfully, but these errors were encountered: