Intended outcome:
Use Query component to get data
Actual outcome:
data in callback child render function is empty when there is graphql error for one key, but not all. If you inspect the http request, there are some valid data in 'data' field.
How to reproduce the issue:
Use Query component, to query several data fields, throw one error in one resolver, and keep other fields return valid data.
Versions
"react-apollo": "^2.1.3",
blocking
@nicolasxu-bg I think this is a react-apollo
issue more than apollo-client
, but try adding errorPolicy="all"
to your Query
component:
<Query errorPolicy="all" ...etc />
That should give you the most data despite errors inside some of the resolvers, etc.
Read more: https://www.apollographql.com/docs/react/features/error-handling.html#policies
(This issue can probably be closed.)
See the solution mentioned in https://github.com/apollographql/apollo-client/issues/3529#issuecomment-393389772 (thanks @jasonrhodes!).
Most helpful comment
@nicolasxu-bg I think this is a
react-apollo
issue more thanapollo-client
, but try addingerrorPolicy="all"
to yourQuery
component:That should give you the most data despite errors inside some of the resolvers, etc.
Read more: https://www.apollographql.com/docs/react/features/error-handling.html#policies