# Apollo cache propagates between two different queries

**URL:** <https://community.apollographql.com/t/apollo-cache-propagates-between-two-different-queries/5803>\
**Category:** Client SDKs\
**Tags:** client, web\
**Created:** [February 24, 2023, 1:39pm UTC](https://community.apollographql.com/t/apollo-cache-propagates-between-two-different-queries/5803 "2023-02-24T13:39:14Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Oskii2311](https://sea1.discourse-cdn.com/flex019/user_avatar/community.apollographql.com/oskii2311/32/3942_2.png) [@Oskii2311](https://community.apollographql.com/u/Oskii2311)\
**Post date:** [February 24, 2023, 1:39pm UTC](https://community.apollographql.com/t/apollo-cache-propagates-between-two-different-queries/5803/1 "2023-02-24T13:39:14Z")

</div>

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:

```auto
{
  "id":"f_UW6RWi"
  "city":"CITY B"
  "__typename":"Address"
}

```

cart which returns data:

```auto
{
  "id":"123"
  "address":{
    "id":"f_UW6RWi"
    "city":"CITY B"
    "__typename":"Address"
  }
  "__typename":"Cart"
}

```

and order:

```auto
{
  "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.

1. Get address Query
2. Get cart Query
3. Get order Query
4. Order query updates address cache.
5. Address and cart returns query with bad address

---

<div class="post-metadata">

**Author:** ![lenz](https://sea1.discourse-cdn.com/flex019/user_avatar/community.apollographql.com/lenz/32/4007_2.png) [@lenz](https://community.apollographql.com/u/lenz)\
**Post date:** [February 24, 2023, 1:53pm UTC](https://community.apollographql.com/t/apollo-cache-propagates-between-two-different-queries/5803/2 "2023-02-24T13:53:39Z")

</div>

This happens, because both of those addresses do have the `__typename` `"Address"` and the `id` `"f_UW6RWi` - that is your server telling Apollo Client that they are the same address. If this is not the case, you could use a [`typePolicy`](https://www.apollographql.com/docs/react/caching/cache-field-behavior/#specifying-key-arguments) to override the `keyArgs` for the `"Address"` type to something different from `id`.

But personally, I would go and start researching why the server is returning two different entities with the same id. That is very odd and should probably not happen.
