
11/9/2022
What this post added
This post provides a deep dive into the Apollo Client's InMemoryCache, explaining its lifecycle stages: Fetching, Normalization, Updating and Merging, and Garbage Collection/Eviction. It details how data is stored in a flattened structure using normalized keys derived from `__typename` and `id` (or custom `keyFields`), and explains the conditions under which the cache automatically updates the UI versus when manual intervention (update functions) is required. The post also revisits an earlier example of a GraphQL query returning unexpected data due to a missing `slug` field, implying that understanding the cache's normalization and merging behavior is key to debugging such issues.