question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

React-apollo 2.5.5 doesn't add client to context

See original GitHub issue

Using offix 0.5.0. This is a basic react-native expo project as discussed in #23. With react-apollo 2.5.5 <ApolloConsumer> fails to find the client on the context. Pinning react-apollo to 2.5.2 works. I’m not sure if this is caused by a react-apollo bug or by offix. https://github.com/apollographql/react-apollo/issues/2900 discusses the issue but only when using MockedProvider and it appears a fix was put in for that.

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:5 (4 by maintainers)

github_iconTop GitHub Comments

2reactions
evelantcommented, Apr 23, 2019

Sorry I didn’t provide a snippet, I am providing the client to <ApolloProvider/> as you illustrated. That fails on react-apollo 2.5.5 but works on 2.5.2. I haven’t had the opportunity to dig further into the issue yet but I’ll update here if I find up with something. I’m more focused on getting a complete working example set up before investigating this since it has an easy workaround for now.

0reactions
wtrockicommented, Jun 14, 2019

Tried that now with Apollo 2.6 and it felt that this was bug on their side.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Could not find "client" in the context of ApolloConsumer when ...
I have a React component that makes use of <ApolloConsumer> in order to access its client render prop and explicitly call client.query when...
Read more >
React Apollo Error: Invariant Violation: Could not find "client ...
Invariant Violation: Could not find "client" in the context or passed in as an option. Wrap the root component in an , or...
Read more >
Context Link - Apollo GraphQL Docs
The setContext function accepts a function that returns either an object or a promise, which then returns an object to set the new...
Read more >
open-source-community/apollographql-react-apollo
Easy to use, human readable and machine processable release notes for everyone.
Read more >
An Intro To Apollo GraphQL With React Hooks And Context API
Before creating the container components, let's write our first Apollo Client hook. Create usePetsHooks.js in hooks folder with the following code. import { ......
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found