How to merge objects when incoming and existing both objects are normalised?

I have merge function defined for mutation similar to following

{
  typePolicies: {
    Mutation: {
      fields: {
        myMutation: {
          merge: (existing, incoming, props) => { 

          }
        }
      }
    }
  }
}

In the above, both incoming and existing are pointing to the ref objects and always picks the values from cache.
Due to this, I am not able differentiate between incoming and existing objects and perform custom merge here.

I need to access the incoming object from the api call but I always end up accessing stale object from the cache.
How to go about solving this?

1 Like