-
const [results, refetchClasses] = useQuery({ The context here is that we want to pagination all Spainish records then, when there are no more (or none to begin with), the query is to then begin to return all 'US' classes. What actually happens is when I paginate through Spanish classes, everything is fine,.... until I switch the variables: {country: 'US'} the cache updates and displays the US content only. The Spanish Records still exist in the cache as do the US that have been fetched, I just need to merge those. Is there a way to read all cache from a query by configuration in graphcache. I would really be appreciative if you could help me on this. This query has a specificType --so unique __typename , and id which the graphcache generates the Key from. |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
That's intentional because they're two separate lists. There are some pieces of information you can find on Relay pagination, but basically the intention is only to merge pages. That said, you can try separating them. However, while you can do a lot of this logic locally, typically the mantra of GraphQL is for your schema to give your UI exactly what it needs, i.e. to make a list that behaves exactly as you need. There are other approaches that you can try out for pagination if that doesn't work for you, but it obviously does require a bit of manual work, e.g. https://formidable.com/open-source/urql/docs/basics/ui-patterns/#infinite-scrolling |
Beta Was this translation helpful? Give feedback.
That's intentional because they're two separate lists. There are some pieces of information you can find on Relay pagination, but basically the intention is only to merge pages.
That said, you can try separating them. However, while you can do a lot of this logic locally, typically the mantra of GraphQL is for your schema to give your UI exactly what it needs, i.e. to make a list that behaves exactly as you need.
There are other approaches that you can try out for pagination if that doesn't work for you, but it obviously does require a bit of manual work, e.g. https://formidable.com/open-source/urql/docs/basics/ui-patterns/#infinite-scrolling