apollo-ios
apollo-ios copied to clipboard
Pagination: Pager does not provide updates during a refresh
Summary
It looks like AsyncGraphQLQueryPager
does not provide updates to previously fetched objects that have changed while it's being refreshed.
I'm not sure if this is more of a bug or a feature request, but it's causing problems for our use case.
Expected behavior: Changes to the data originally provided from the pager is updated while an in-flight refresh request is active.
Actual behavior: The data provided from the pager does not update until the refresh is complete.
Version
1.10.0
Steps to reproduce the behavior
We're using the pager to fetch all pages for a particular query. Later, when we need to refresh the data we call loadAll(fetchFromInitialPage: true)
. This particular query is a bit slow, so it can take a couple of seconds before it completes. In the meantime, we allow the user to interact with the items in the pager, which results in mutations.
It seems while the query is being refreshed, the pager does not clear the results via the subscribe
callback, but it also does not emit any updates for local cache mutations or updates received from subscriptions until the pager completes its work.
Repro steps:
- Setup an
AsyncGraphQLQueryPager
with a subscribe handler. - Load all the data using
loadAll(fetchFromInitialPage: true)
. - Start a refresh using
loadAll(fetchFromInitialPage: true)
. - While the refresh is pending, make a local cache mutation. You should observe that the subscribe handler is not called.
- When the refresh has completed, you should observe that the subscribe handler is called.
Logs
No response
Anything else?
No response