-
Hello, I'm currently evaluating URQL but I have previous experience with Apollo. One of the largest pain points is inserting into a paginated list when a new item is created. I see this post about that topic https://www.howtographql.com/react-urql/7-pagination-and-cache-updates/ but I had a question about the last code block. It seems like the variable is hardcoded but this seems impractical. Generally, this would be in a completely different file of the query so it wouldn't know what the variables are. If we change the query to fetch 20 items we would need to remember to update it here. I was wondering if it is possible to define something like
|
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 1 reply
-
I am also facing this problem, inserting stuff into paginated lists. Maybe the best thing would be to trigger loading of another page after creation? I cannot do |
Beta Was this translation helpful? Give feedback.
-
you can use the This is the same method by which our pagination resolvers (like |
Beta Was this translation helpful? Give feedback.
you can use the
cache.inspectFields
method for this. It allows you to inspect which fields the cache knows about which means that it'll help you identify which cache fields to update. https://formidable.com/open-source/urql/docs/graphcache/cache-updates/#updating-many-unknown-linksThis is the same method by which our pagination resolvers (like
relayPagination
) determines which pages to merge.