Error within Apollo Client is not catched and creates an infinite loop
See original GitHub issueWhen a error within the apollo-client or the react-apollo-hooks library occurs it does not get returned as an error. React Suspend waits for the Promise, and tries to render it in an infinite loop.
https://codesandbox.io/s/zx2n727o33
even though a Network Error from apollo-client is written to the console every 50ms, the error does not get forwarded as an response to useQuery, nor does it get catched by componentDidCatch
Issue Analytics
- State:
- Created 5 years ago
- Reactions:1
- Comments:8 (3 by maintainers)
Top Results From Across the Web
Handling operation errors - Apollo GraphQL Docs
Apollo Client can encounter a variety of errors when executing operations on your GraphQL server. Apollo Client helps you handle these errors according...
Read more >reactjs - Overcome endless looping when executing useQuery ...
Finally, I've figured out. I faced the same problem and I solved it by excluding new ApolloClient from render function.
Read more >Error within Apollo Client is not catched and creates an infinite loop
Coming soon: A brand new website interface for an even better experience!
Read more >Error handling with Apollo Client | Tomek's blog
React limits the number of renders to prevent an infinite loop.”. When we want to display a custom component we should use error...
Read more >Apollo GraphQL : Async Access Token Refresh - Able
You're returning the observable in the callback when mapping graphql errors so it is not actually returned from the ErrorHandler and apollo-link ...
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 Free
Top 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

It’s fixed in version 0.2.0. Right now error is returned as a part of the
useQueryresult, but I’m thinking about rethrowing them and using error boundaries instead. What do you think? Could you comment in #28 ?I’ve got an idea how to fix it, and I’ll try to implement it in the next few days. I’m going to add a helper class responsible for managing queries and store instances of it in a WeakMap, outside of React context (with Apollo client instances as keys).