You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Apr 13, 2023. It is now read-only.
Hi, I've been using react-apollo for weeks and it's been great. But there is one thing with the Query component that I don't understand and makes some problems. Why Query component does not pass all errors as render props and some of them should be caught using try-catch?
Look at the code below:
Some errors are passed as error and there is no error thrown, but some of errors are caught using try-catch. It is fine but it cause some problems, like the inner component had to be render two times, so some problems like losing focus and resting the whole things happen which is not fine.
So my question: Is there any way to make the Query component pass all types of errors as render props and nothing needs to be caught by try-catch?
p.s: I used errorPolicy prop and it didn't make any changes.
Thanks
The text was updated successfully, but these errors were encountered:
If you do not have a problem with your client side setup, apollo should return errors as part of the result. If you are seeing different behavior, please file an issue with apollo-client.
react-apollo is a react component based consumer of apollo-client. In the case of Query, it uses client.watchQuery. I suspect you are seeing an error thrown from your link setup code or something else, not from a HTTP 200 graphql error that apollo interprets and returns as a result.
We have a large app and have never encountered the case you are presenting. If you can reproduce, please ping me and I'll reopen if it is a problem inside Query.
@rosskevin As you see this issue was for months ago and I had same problems till the last time I remember so I gave up using render prop and used the HOC style (withApollo) and it works fine. I don't know if it's still an issue with <Query /> or not (I saw some activities regarding similar issues). However I think React is making some changes on the whole HOC and its problems so with new React we may not need render prop anymore in near future. Maybe!
Sign up for freeto subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Hi, I've been using
react-apollo
for weeks and it's been great. But there is one thing with theQuery
component that I don't understand and makes some problems. WhyQuery
component does not pass all errors as render props and some of them should be caught usingtry-catch
?Look at the code below:
Some errors are passed as error and there is no error thrown, but some of errors are caught using
try-catch
. It is fine but it cause some problems, like the inner component had to be render two times, so some problems like losing focus and resting the whole things happen which is not fine.So my question: Is there any way to make the
Query
component pass all types of errors as render props and nothing needs to be caught bytry-catch
?p.s: I used
errorPolicy
prop and it didn't make any changes.Thanks
The text was updated successfully, but these errors were encountered: