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
QueryResult.errors was recently deprecated in #11954, with message "Please use error.graphQLErrors instead." But this field is not consistently populated. If a graph resolver throws, the errors property is always set, but error appears to be only populated if errorPolicy is "none".
Click on "Load All People" in linked sandbox. Observe that console log of the result has an undefined error field, but populated errors. Change errorPolicy to "none". Now both will be populated.
@apollo/client version
3.11.4
The text was updated successfully, but these errors were encountered:
I can't promise we can look at this until after next week as the team will be gone to a conference, but we will try to take a look sometime after. Thanks for bringing this to our attention!
We ran into this also when changing server side client.query to use errorPolicy: 'all'. The errors field is set to the graphQLErrors but the error result key is undefined. This is inconsistent with the hooks and prevents us from being able to see stuff like protocolErrors, clientErrors, networkError, etc.
In the source code it says error is "The single Error object that is passed to onError and useQuery hooks, and is often thrown during manual client.query calls.".
Imo this should be returned in error also when doing client.query calls.
We were working on trying to set our default policy to all but it seems like there are some bugs/inconsistencies with this policy.
Issue Description
QueryResult.errors was recently deprecated in #11954, with message "Please use
error.graphQLErrors
instead." But this field is not consistently populated. If a graph resolver throws, the errors property is always set, but error appears to be only populated if errorPolicy is "none".Link to Reproduction
https://codesandbox.io/p/devbox/snowy-sky-ypkmvp?workspaceId=125b734b-01fa-4547-907b-915bf55739e9
Reproduction Steps
Click on "Load All People" in linked sandbox. Observe that console log of the result has an undefined
error
field, but populatederrors
. Change errorPolicy to "none". Now both will be populated.@apollo/client
version3.11.4
The text was updated successfully, but these errors were encountered: