Closed evelant closed 5 years ago
@AndrewMorsillo I think we are missing documentation how to get thins running in react (and react native). Apollo Provider will have client propperty where we should provide client as follows:
async componentDidMount() {
const offlineClient = await createClient(...)
this.setState({offlineClient})
}
render() {
const {offlineClient} = this.state
if (!apolloClient) return 'Loading the app'
return (
<ApolloProvider client={offlineClient}>
...
</ApolloProvider>
)
}
Going to add this to documentation.
Sorry I didn't provide a snippet, I am providing the client to
@AndrewMorsillo Maybe this is related to the problem in breaking API upstream. I will update the package and check what was changed here and resolve the issue.
Let me check that carefully and I will provide update here and release new fix.
Simply updating dependencies to Apollo here should work fine. We are working now on React sample app with Ionic where we going to try out these cases and improve things.
Tried that now with Apollo 2.6 and it felt that this was bug on their side.
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.