Using the latest betas for v2, when using IntrospectionFragmentMatcher I get the networkError TypeError: context.fragmentMatcherFunction is not a function.
Only pages that have interfaces/union queries on them cause this error, other pages are fine.
Version
@jaydenseric interesting! Do you have a small app I can take a look at! I'll try to figure out what's happening
This was encountered on our main project and is blocking the v2 upgrade. I don't have a small demo project handy, sorry. I am quite sure the issue is with v2 though since everything is fine on v1.
@jaydenseric how are you setting up the FragmentMatcher? With the cache constructor? Can you share any of that code? I'd love to figure this out and get it fixed for you ASAP!
@jaydenseric I think I see the issue! I'll publish a fix for it and let you know when to try it out!
@jbaxleyiii awesome, I am reapplying the v2 update now, so hopefully will be ready to try the fix in the next few minutes.
Fixed with https://github.com/apollographql/apollo-client/pull/2281
It should be on the Cache, but the interface was expecting the .match function instead of the actual Matcher
cc @jaydenseric
cutting a beta now!
@jaydenseric try beta.5 of the inMemoryCache package 馃憤
@jbaxleyiii everything looks fine 馃槏
I am using a custom fragmentMatcher this time, instead of the IntrospectionFragmentMatcher exported from apollo-cache-inmemory, but that should not relate to this issue.
Want to talk about that some time BTW. It would be great if apollo-cache-inmemory exported a plain FragmentMatcher that initializes with a minimal implementations map; skipping the bulky introspection result input and processing logic. Smaller bundle, and easier tooling to come up with the map... just read a schema._implementations which is in the perfect format already. I have a fantastic build setup tapping into graphql-config that is only a few lines long. Might be good to document.
@jaydenseric I'd LOVE to hear more about it!
@jbaxleyiii here is a gist, with a few minor simplifications from what we are using in our app.
Happy to talk it though or even screenshare our setup.
@jaydenseric cool solution!
@jbaxleyiii I think this issue isn't closed yet. I am using the latest versions of all packages, and still getting this error when using IntrospectionFragmentMatcher