Dev Tools broken for anyone using `apollo-link-rest`
Hello :)
I am introducing some of my coworkers to the fabulous DX of Apollo Client by showing them a complete setup using apollo-link-rest. There is not a graphql server at all; only a traditional REST API.
I believe that when the introspection query feature was introduced back in March the ability to use the dev tools for people like me — who are using ApolloClient exclusively for REST endpoints — broke. It now throws the following error:
TypeError: Cannot read property '__schema' of undefined
This is where I believe the problem was introduced:
https://github.com/apollographql/apollo-client-devtools/blob/master/src/devtools/components/Explorer/Explorer.js#L194
In it, there is no guard against an undefined result which is the outcome when getIntrospectionQuery failes to find a graphql server.
While I am quite capable of adding a guard around the code I linked, I have absolutely no idea what the downstream effects would be. Given my lack of familiarity with the codebase, It will take me a while to cut a PR for this. I will work on this in my spare time but be quite happy if someone more familiar with the project issued a fix for this issue faster than I am able.
🤞
I was able to find a workaround for this by instantiating ApolloClient with typeDefs: {}
Can confirm that fixed it for me, thanks @AllenAnthes
This should no longer be an issue - thanks!