[Graphcache] Equivalent to ApolloClient's writeQuery / writeFragment? #1059
-
I am considering migrating from Apollo Client to urql, but I am unsure of how I would solve writing to Graphcache without executing a Mutation. I want to optimize my requests to the API. Thus it doesn't feel right to me in some cases. Any solutions to achieve something similar in the urql way? |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
Hey, GraphCache doesn't allow this with a reason, we have structured this cache to rely on the backend as a source of truth. This means that if we alter the cache outside of a mutation that we'd be straying away from our source of truth. |
Beta Was this translation helpful? Give feedback.
Hey,
GraphCache doesn't allow this with a reason, we have structured this cache to rely on the backend as a source of truth. This means that if we alter the cache outside of a mutation that we'd be straying away from our source of truth.
Doing so can lead to indeterministic behavior which is something we're aiming to avoid, this seems to indicate that the alteration you perform never exits the cache (it never updates the server-data) which results in a discrepancy for the data.