Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

context.fragmentMatcherFunction is not a function #2247

Closed
jaydenseric opened this issue Oct 4, 2017 · 11 comments
Closed

context.fragmentMatcherFunction is not a function #2247

jaydenseric opened this issue Oct 4, 2017 · 11 comments
Assignees
Milestone

Comments

@jaydenseric
Copy link
Contributor

jaydenseric commented Oct 4, 2017

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

  • apollo-client@2.0.0-beta.4
  • apollo-link@0.7.0
  • apollo-link-batch-http@0.3.0
  • react-apollo@2.0.0-beta.0
@jbaxleyiii
Copy link
Contributor

@jaydenseric interesting! Do you have a small app I can take a look at! I'll try to figure out what's happening

@jbaxleyiii jbaxleyiii self-assigned this Oct 10, 2017
@jbaxleyiii jbaxleyiii added this to the 2.0 milestone Oct 10, 2017
@jaydenseric
Copy link
Contributor Author

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.

@jbaxleyiii
Copy link
Contributor

@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!

@jbaxleyiii
Copy link
Contributor

@jaydenseric I think I see the issue! I'll publish a fix for it and let you know when to try it out!

@jaydenseric
Copy link
Contributor Author

@jbaxleyiii awesome, I am reapplying the v2 update now, so hopefully will be ready to try the fix in the next few minutes.

@jbaxleyiii
Copy link
Contributor

Fixed with #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!

@jbaxleyiii
Copy link
Contributor

@jaydenseric try beta.5 of the inMemoryCache package 👍

@jaydenseric
Copy link
Contributor Author

jaydenseric commented Oct 11, 2017

@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.

@jbaxleyiii
Copy link
Contributor

@jaydenseric I'd LOVE to hear more about it!

@jaydenseric
Copy link
Contributor Author

@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.

@dotansimha
Copy link
Contributor

@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

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Feb 17, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants