apollo client 2.0.4, how get the store, from new onError , apollo-link-error
See original GitHub issueI’have migrated from apollo 1, all it’s working well , but just errors, with apollo 1 I used to catch the errors on my mutate action, and inside I had props, to call translate, redux saga and another states to show errors and change the behaviour accord errors. with apollo2 looks different.
my problem is get the state from my redux inside the new onError ;, that is imported with : import { onError } from ‘apollo-link-error’;
const errorLink = onError((Error) => {
console.log('store',store.getState()); // does not work
(..)
}
on my app.js
<ErrorBoundary>
<Provider store={store} >
<ApolloProvider client={client}>
<BrowserRouter>
<Switch>
i’m doing well have apolloprovider inside Provider(redux) ? this the only thing to send my new project in new version 2 that looks fantastic.
Version “react-apollo”: “2.0.4”,
Issue Analytics
- State:
- Created 6 years ago
- Comments:8 (1 by maintainers)
Top Results From Across the Web
Error Link - Apollo GraphQL Docs
Use the onError link to perform custom logic when a GraphQL or network error occurs. You pass this link a function that's executed...
Read more >File Upload with GraphQL, Apollo Server, Hapi 18+, and React
4. Read the file stream and write a file successfully on the server side. Let's get started! Client-side React code with mutation.
Read more >react-apollo: An approach to handle errors globally
The Apollo client, or the react-apollo binding to be precisely, ... called onError which takes an error object and performs a complete new...
Read more >apollo-link-error | Yarn - Package Manager
Use this link to do some custom logic when a GraphQL or network error happens: import { onError } from "apollo-link-error"; const link...
Read more >How to use import { onError } from 'apollo-link-error' in angular ...
Hi and Welcome to Stack Overflow! Do you get any errors in your console? What is the actual behaviour of your current application,...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@webmobiles you will have to export your
store
object inapp.js
like this:then you can just import it where you need it:
Best,
This is a React Apollo issue, and is being tracked here: https://github.com/apollographql/react-apollo/issues/1360 (see workaround in https://github.com/apollographql/react-apollo/issues/1360#issuecomment-347556125). Since this is already being tracked in the React Apollo repo, I’ll close it here. Thanks!