I’m building an app that makes several requests to the same field (competitions) with different filtering options. Mostly they are filtered depending on start and end date to determine and display the competitions in different views depending on if they are upcoming, ongoing or completed. Also there’s a search function, calling and filtering the same field “competitions”.
On the page “All Competitions” I’d like to add offset pagination, which works fine by it’s own when added as offsetLimitPagination() as a typePolicy on the field “competitions” in the InMemoryCache.
However, this of course messes up the cache rules everywhere else where the “competitions” field is called, by merging items in the cache that doesn’t corresponds with each queries rules, but is stored under “competitions” in the cache.
It’s possible to bypass by using “no-cache” in the fetchPolicy of the other queries, but then we loose most of the benefit using Apollo Client.
How would one go about solving this issue? As it is now, either everything works but the pagination on the All Competitions-page, or the other way around. There should be a way to define different typePolicies for different pages/routes in the app.
I’ve always envisaged this issue ever since we first started to use the relayStylePagination field policy in AC3 and now it has presented itself to us because one component needs infinite pagination and another needs separate pages, e.g.
@somnas, did you find a solution? I guess we need some way to tell the field policy to only ignore the pagination arguments (first, after, last, before) when we want to paginate infinitely?