apollo.ts

 1import { ApolloClient, InMemoryCache } from '@apollo/client';
 2
 3import introspectionResult from './fragmentTypes';
 4
 5const client = new ApolloClient({
 6  uri: '/graphql',
 7  cache: new InMemoryCache({
 8    possibleTypes: introspectionResult.possibleTypes,
 9    typePolicies: {
10      // TODO: For now, we only query the default repository, so consider it as a singleton
11      Repository: {
12        keyFields: ['name'],
13      },
14    },
15  }),
16});
17
18export default client;