-
I am using We have the following project page,
The problem is that even when the Maybe it is possible to use Of course, it would be possible to solve this problem with application logic that keeps the response result and replaces it on success, but I would be very happy if urql's functionality could make this happen. |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 2 replies
-
I'm just boiling this down to the above three quotes first. First of all,
To state simply how the API works, once you “tag” a query and mutation with In other words, although you have a specific case where invalidation isn't expected, the document cache especially will always err on the side of treating invalidating as the safe option. In other words, the reason the document cache exists is because, when we map GraphQL data to our UI and want it to stay up-to-date, we just want to re-execute slightly fewer operations than renders to keep it up-to-date. So, this is expected.
The simplest answer here is, please don't do this. I know a lot of people are tempted by this, but it's bad schema design for three reasons:
So, with our without a normalized cache, I'd consider changing this at least to: type Mutation {
updateProject(id: ID!, input: ExampleInput): Project
} This is not a big change for the implementation and delivers an updated
Last point, I'd be careful here. But you may want to make sure that your UI can cope with changes — i.e. if your inputs are important, you may want to make sure that a refetch can't destroy them. If your users rely on updates while also making inputs, I see this as a symptom of future problems. It's hard to chase “zero updates while editing” and a much longer journey of potentially worse UX/DX, rather than investing time now to make sure that user-editable UI can cope with refreshes. That's easily said, I know, but that's about it. To summarise, this is all expected behaviour to me. Hope that makes sense ✌️ |
Beta Was this translation helpful? Give feedback.
I'm just boiling this down to the above three quotes first.
First of all,
To state simply how the API works, once you “tag” a query and mutation with
additionalTypenames
, that’s a definitive tag. The safest option is to always invalidate.In other words, although you have a specific case where invalidation isn't expected, the document cache especially will always err on the…