Ma-ft
1
When creating a new InMemoryCache is there a way to say
"*": {
keyFields: ["uuid"],
},
instead of
Entity1: {
keyFields: ["uuid"],
},
Entity2: {
keyFields: ["uuid"],
},
Entity3: {
keyFields: ["uuid"],
},
Hey @Ma-ft
!
Take a look at the dataIdFromObject
API. This might be what you’re looking for as it allows you to define global fallback cache ID.
1 Like
Ma-ft
3
Thanks i ended up going with below
import { defaultDataIdFromObject } from '@apollo/client';
const cache = new InMemoryCache({
dataIdFromObject: (r) => {
if (r.__typename) {
return (r.uuid as unknown) as string;
}
return defaultDataIdFromObject(r);
},
});
now i can just focus on explicit typePolicies for outlier Entities 
1 Like