Hello everyone,
I am using interfaces in my graphql server and want to get rid of the heuristic matcher warnings in the console.
I think I need to use introspectionFragmentMatcher with reason-apollo, but I don’t know how…
In the source code of apollo-reason there is :
type fragmentMatcher;
[@bs.module "apollo-cache-inmemory"] [@bs.new]
external introspectionFragmentMatcher : Js.t({..}) => fragmentMatcher =
"IntrospectionFragmentMatcher";
let createIntrospectionFragmentMatcher = (~data) =>
introspectionFragmentMatcher({"introspectionQueryResultData": data});
/* Instantiate a new cache object */
[@bs.obj] external
makeApolloInMemoryCacheParams :
(
~dataIdFromObject: (Js.t({..}) => string)=?,
~fragmentMatcher: fragmentMatcher=?
) => _ = "";
let createInMemoryCache = (~dataIdFromObject=?, ~fragmentMatcher=?, ()) => {
/* Apollo Client, looks for key in Object. Doesn't check if value is null */
apolloInMemoryCache(
makeApolloInMemoryCacheParams(~dataIdFromObject?, ~fragmentMatcher?)
);
};
So I should probably use :
let inMemoryCache = ApolloInMemoryCache.createInMemoryCache( ~fragmentMatcher = ApolloInMemoryCache.createIntrospectionFragmentMatcher(~data=whatToPutHere) )
which will call :
let createIntrospectionFragmentMatcher = (~data) =>
introspectionFragmentMatcher({“introspectionQueryResultData”: data});
In apollo docs they use
import introspectionQueryResultData from ‘./fragmentTypes.json’;
What should I pass as the “data” argument to createIntrospectionFragmentMatcher?
Thanks for your help