-
Notifications
You must be signed in to change notification settings - Fork 110
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Error within Apollo Client is not catched and creates an infinite loop #23
Comments
True, it loops over and over and let the "suspense" component in place instead of recalling the "query" component with "errors" populated. |
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). |
Same here, completely ignoring |
It's fixed in version 0.2.0. Right now error is returned as a part of the |
I've just tested this 0.2 release, the infintite loop is gone, but I don't get the error with useQuery. I just have data and errors keys "undefined", while on-the-wire, I can see (partial) data and errors inside the server response. Any ideas ? Anthony. |
@trojanowski It seems the reason of my previous message is due to typescript types. ApolloQueryResult has a key "errors" (an array of gql errors), but the object returned by useQuery contains only an "error" key. |
@atoy40 Could you provide more details (maybe better in the #29 issue )? I I guess you use the
I going to rewrite this library to typescript in the future, so it should lower the chance of similar errors. Anyway I just forward the response from apollo client ( react-apollo-hooks/src/index.js Line 70 in e1a9b6f
react-apollo-hooks/src/index.js Line 73 in e1a9b6f
|
@trojanowski yes I get a 200 response, with the "errors" key defined. But if i do :
result contain only an "error" key, but not an "errors" key. |
When a error within the
apollo-client
or thereact-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
fromapollo-client
is written to the console every 50ms, the error does not get forwarded as an response touseQuery
, nor does it get catched bycomponentDidCatch
The text was updated successfully, but these errors were encountered: