-
Hi everyone. Sorry if the topic is common however I was looking in the previous posts and didn't find nothing relative\helpful. Sorry for the long codebase but it's important to understand the context. Basically I have the standard pagination list for the messages.
I'm executing the
It creates a message and my headache begins. I need to update the
It updates the cache and the new items renders in the list without the page reloading however after the result inspection I found that it doesn't updates the pageInfo data of the channelMessages query result. I mean nor the cursors nor the items count. I think it's wrong at all but I don't know what to do with that.
I appreciate for any help guys. This is the one of the few crutial things that block me from understanding how to correctly work with URQL |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 3 replies
-
There is a very similar question that's been asked just a few days ago that I just responded to: #3207 Basically, make sure that you only update one page, preferably the last one if you're appending and the first one if you're prepending. If you need to update the It's not a bad idea to ensure that pages refetch, but keep in mind that you may not have to do this until the user starts interacting with the list again, unless you have a need to earlier. Depending on how your pagination works, and if you don't use React Native, you may even be able to simplify and ditch This may give you more flexibility when iterating over pages as on each load you can load the pages one by one. Additionally, if you just want to "give up", you can use |
Beta Was this translation helpful? Give feedback.
Just to address the questions you had separately as well,
Yes. You could even avoid using a complete query by providing a fragment and using
cache.readFragment
andcache.writeFragment
.That's preference based. You can't use
cache.link
in this case (which is often the shortest way to update relations) because you likely have to write the edge to the cache as well however.But the simplest update is to only update the list field, the edge, and only select keyable fields on your fragment.