Skip to content

Instantly share code, notes, and snippets.

@chandan-reddy-k
Created May 8, 2019 05:37
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save chandan-reddy-k/e163894ef8b2872f11944db26080ad1d to your computer and use it in GitHub Desktop.
Save chandan-reddy-k/e163894ef8b2872f11944db26080ad1d to your computer and use it in GitHub Desktop.
Introspection Fragment Matcher
import ApolloClient from 'apollo-client';
import { InMemoryCache } from 'apollo-cache-inmemory';
import { HttpLink } from 'apollo-link-http';
import { IntrospectionFragmentMatcher } from 'apollo-cache-inmemory';
import introspectionQueryResultData from './fragmentTypes.json';
const fragmentMatcher = new IntrospectionFragmentMatcher({
introspectionQueryResultData
});
const cookies = new Cookies();
const httpLink = new HttpLink({ uri: 'https://api.example.com/graphql' })
const cache = new InMemoryCache({ fragmentMatcher });
export const client = new ApolloClient({
cache,
link: new HttpLink(),
});
@pankajnegi1893
Copy link

where is fragmentTypes.json file ??

@chandan-reddy-k
Copy link
Author

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment