How do you reconcile Apollo cache for two queries on the same object that return different subsets of data?

Viewed 297

For example, let's say I have a query A for some Resource:1

Resource {
 id
 info
}

and another query B for the same Resource:1

 Resource {
  id
  info
  additionalInfo
 }

In most cases this isn't an issue, but it seems like the order of these queries matters. If A runs, then B runs, then A runs again, an optimistic response from a Mutation interleaved with these Queries may crash, citing that additionalInfo is missing from the current state of Resource:1 in the cache. I assume this is from the results of Query A overwriting the results of Query B in the cache.

In the case of a Mutation, I would just use the update callback to reconcile the cache manually between each of these calls, but is there an equivalent operation for Queries?

0 Answers
Related