satanTime / ngrx-entity-relationship

ORM selectors for redux, @ngrx/store, @ngrx/entity and @ngrx/data. Ease of relationships with entities.

Home Page:https://ngrx-entity-relationship.sudo.eu

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

local cache from GraphQL based on object type as a root key

satanTime opened this issue · comments

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,
        };