I’m trying to get infinite scrolling working with Apollo and GQL. An obvious solution would be to replicate the RedwoodApolloProvider and have a cache strategy for that particular page.
I’m posting here first to see if there’s any other solutions to get useQuery
's fetchMore
method working with data merging - or even just editing the client’s memory strategy - without having to maintain my own fork of the Redwood GQL Client.
I just opened an issue about this before finding your post. I’ve arrived at the same dead end you have - it appears the only way to use fetchMore is to set up a custom ApolloProvider because the Redwood one doesn’t expose the cache, meaning you have no way to customize the memory strategy and implement merging.
I got this working but it required making my own custom RedwoodApolloProvider
that allowed me to access the cache config. I will PR this into the main repo so we can hopefully get access to this in a more official capacity. Until then, the workaround is in the issue.