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.

Error within Apollo Client is not catched and creates an infinite loop

See original GitHub issue

When 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:closed
  • Created 5 years ago
  • Reactions:1
  • Comments:8 (3 by maintainers)

github_iconTop GitHub Comments

3reactions
trojanowskicommented, Nov 30, 2018

It’s fixed in version 0.2.0. Right now error is returned as a part of the useQuery result, but I’m thinking about rethrowing them and using error boundaries instead. What do you think? Could you comment in #28 ?

1reaction
trojanowskicommented, Nov 26, 2018

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).

Read more comments on GitHub >

github_iconTop 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 >

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