How to update apollo cache

How to update apollo cache


0

I am wondering why it’s very hard to update a data inside of apollo client cache, comparing to similar libraries like react-query it’s too complicated

For example, When I have a query with pagination (offset and limit) and get an array of items, When I perform a mutation on one item , and from the server response, I get updated item, how can I replace that cached item?

I found using updateQuery required variables which means, to updated an item of array, I need to have offset and limit variables. But I don’t want to make my code over complicated. I want to replace item in the cache

using cache.modify is not obvious as well, as it requires fields function but I want to easily update all fields

writeFragment needs to define Fragment and it’s hard as well


Load 6 more related questions


Show fewer related questions

0



Leave a Reply

Your email address will not be published. Required fields are marked *