Pagination with relayStylePagination - how to use ALL keyArgs?
See original GitHub issueHi. I have multiple queries with a long list of arguments that I am using for filtering items.
Apollo Cache works perfectly well without pagination: each list of items cached separately to each set of arguments (filters) and on UI I can always see the proper list of items.
When I have added relayStylePagination()
to InMemoryCache
this behavior was broken. If I understand the reason correctly it’s because of the default keyArgs: false
for relayStylePagination()
.
The question: is it possible to force relayStylePagination()
behave the same as it was by default without pagination? I mean that relayStylePagination()
will get in count all the arguments and separate cached lists with different sets of arguments.
Alternatively, I can path all my arguments to relayStylePagination()
, but this will be ugly and hard to support.
const cache = new InMemoryCache({
typePolicies: {
User: {
fields: {
models: relayStylePagination([longListOfCustomAndChangingArgumensShouldBeHere]),
animals: relayStylePagination([longListOfCustomAndChangingArgumensShouldBeHere]),
locations: relayStylePagination([longListOfCustomAndChangingArgumensShouldBeHere])
}
},
},
})
Issue Analytics
- State:
- Created 2 years ago
- Comments:5 (4 by maintainers)
Top GitHub Comments
Yep that should work!
Another trick for excluding object properties is to use object
...rest
notation:Sounds like this has been solved. Thanks!