Headless Server Developer Manual / Version 2110
Table Of ContentsIt is necessary to configure the InMemoryCache for the caching to work correctly and to successfully map every item to an ID.
Since CoreMedia content types are more complex than just Boolean, string or number, the Apollo cache needs to know what kind of supertypes to expect and what types they consist of. This helps to identify cacheable content types like banner, CMArticle or CMCollection. Therefore, the possible types need to be generated from the schema and included in the cache configuration.
The easiest way is to create a separate script to download them as JSON and save it as possibleTypes.json
in your app.
More information on this and a complete code example can be found in the documentation for "generating possible types automatically".
import possibleTypes from './possibleTypes.json'; const client = new ApolloClient({ cache: new InMemoryCache({ possibleTypes }) ... });
Example 14.3. Configuring the Apollo Cache
Caution
If you don’t add the generated list of possible types to the ApolloClient, the following components do not include and render any other property than the id.