Created
May 8, 2019 05:37
-
-
Save chandan-reddy-k/e163894ef8b2872f11944db26080ad1d to your computer and use it in GitHub Desktop.
Introspection Fragment Matcher
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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(), | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
It’s generated automatically once you run the build script.
Refer these :
Blog - https://medium.com/commutatus/whats-going-on-with-the-heuristic-fragment-matcher-in-graphql-apollo-client-e721075e92be
Video - https://youtu.be/6hHbVYISndo