Hi,
I have a problem with apollo cache and I have no idea what is the best way to get around this problem.
Lets assume I have 3 queries:
addressQuery, which returns data:
{
"id":"f_UW6RWi"
"city":"CITY B"
"__typename":"Address"
}
cart which returns data:
{
"id":"123"
"address":{
"id":"f_UW6RWi"
"city":"CITY B"
"__typename":"Address"
}
"__typename":"Cart"
}
and order:
{
"id":"321"
"address":{
"id":"f_UW6RWi"
"city":"CITY A"
"__typename":"Address"
}
"__typename":"Order"
}
The problem is that when I fetch an order then the order query changes the address ref and this new ref propagates to cart address. I don’t want such a logic because they are two different addresses with different cities.
I can get around this problem by adding fetchPolicy:no-cache to the order request, but I don’t think that’s the best idea.
- Get address Query
- Get cart Query
- Get order Query
- Order query updates address cache.
- Address and cart returns query with bad address