Description
Summary
Add a note for @strapi/plugin-graphql and @apollo/client consumers to configure InMemoryCache to work with documentId
Why is it needed?
I'm using Strapi v5, and were configuring Apollo Client, and could not find any note about this in the docs.
As Strapi v5 is using documentId instead of id, would be good to notify users that they need to configure the InMemoryCache if they would like it to work fine.
Suggested solution(s)
const apolloClient = new ApolloClient({
cache: new InMemoryCache({
dataIdFromObject: (o) => {
const maybeEntityId = o["documentId"]
const maybeComponentId = o["id"]
const id = maybeEntityId ?? maybeComponentId
return ${o.__typename}:${id}
},
}),
});
https://www.apollographql.com/docs/react/caching/cache-configuration#customizing-identifier-generation-globally
Related issue(s)/PR(s)
No response