# Merging normalized objects

**URL:** <https://community.apollographql.com/t/merging-normalized-objects/5755>\
**Category:** Client SDKs\
**Tags:** client, web\
**Created:** [February 17, 2023, 6:26pm UTC](https://community.apollographql.com/t/merging-normalized-objects/5755 "2023-02-17T18:26:36Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![jekelly-adobe](https://sea1.discourse-cdn.com/flex019/user_avatar/community.apollographql.com/jekelly-adobe/32/3916_2.png) [@jekelly-adobe](https://community.apollographql.com/u/jekelly-adobe)\
**Post date:** [February 17, 2023, 6:26pm UTC](https://community.apollographql.com/t/merging-normalized-objects/5755/1 "2023-02-17T18:26:36Z")

</div>

Hello! As the [Apollo Client](https://www.apollographql.com/docs/react/caching/cache-field-behavior#defining-a-merge-function-at-the-type-level) docs say, since 3.3 we can “define a default merge function for a non-normalized object type”.

I’d like to be able to control which of two versions of an object gets merged into the cache _and_ have those objects be normalized. For example:

If incoming.version \> existing.version, cache incoming object  
If existing.version \>= incoming.version, keep existing object in cache

Would very much appreciate any ideas on how to accomplish this on objects that are normalized.

---

<div class="post-metadata">

**Author:** ![JeffAuriemma](https://sea1.discourse-cdn.com/flex019/user_avatar/community.apollographql.com/jeffauriemma/32/2845_2.png) [@JeffAuriemma](https://community.apollographql.com/u/JeffAuriemma)\
**Post date:** [March 13, 2023, 8:58pm UTC](https://community.apollographql.com/t/merging-normalized-objects/5755/2 "2023-03-13T20:58:23Z")

</div>

Hi @jekelly-adobe 👋 welcome to the community forum! I apologize if you’ve already considered this but to get the conversation started, does a `merge` function in the `typePolicies` entry for the normalized objects in question address your use case?

> **[Customizing the behavior of cached fields](https://www.apollographql.com/docs/react/caching/cache-field-behavior/#the-merge-function)**

---

<div class="post-metadata">

**Author:** ![Justin\_Gonzalez](https://sea1.discourse-cdn.com/flex019/user_avatar/community.apollographql.com/justin_gonzalez/32/5359_2.png) [@Justin\_Gonzalez](https://community.apollographql.com/u/Justin_Gonzalez)\
**Post date:** [February 6, 2025, 8:49pm UTC](https://community.apollographql.com/t/merging-normalized-objects/5755/3 "2025-02-06T20:49:16Z")

</div>

Archived on February 6, 2025, 8:49pm UTC


