Replies: 1 comment
-
My advise here would be to create a custom This trick should hold up as long as you leverage only 1 cacheExchange, then you can export a function that does all of this for you. |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
There are a ton of threads about cache invalidation, but I can't find one that's quite the same as my issue.
We currently use urql for some things and an API for others (mostly because we're in the middle of a migration).
For all-urql situations, the way
cacheExchange
does Operation Keys works exactly the way I want: if I do a mutation on"__typename": "Book"
then any query that had"__typename": "Book"
is invalidated.But I have some places where I go through an API. It's mostly legacy code that is updating books via an API. Urql has no way of knowing that those API calls will invalidate all the
Book
s. It would be great to be able to say, right after I do the API call, "Urql, invalidate"__typename": "Book"
.The other solution is to change every place I query
Book
to be a subscription, but that's pretty lame. I shouldn't have to remember this or keep track of it in all my queries: the update-book API call site is where the problem is so I want to fix it there.Is there a way to do this?
Beta Was this translation helpful? Give feedback.
All reactions