local cache from GraphQL based on object type as a root key
satanTime opened this issue · comments
satanTime commented
A possible solution is to use ApolloLink
:
// gqlHandleResponse is our handler from the library
const addDateLink = new ApolloLink((operation, forward) =>
forward(operation).map(gqlHandleResponse),
);
// eslint-disable-next-line unicorn/prefer-spread
const link = addDateLink.concat(
httpLink.create({
uri,
}),
);
return {
cache: new InMemoryCache(),
link,
};