Skip to content
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

useLazyQuery does not populate "error" field if errorPolicy is "all" #12097

Open
gbettencourt opened this issue Oct 18, 2024 · 1 comment
Open
Labels

Comments

@gbettencourt
Copy link

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 populated errors. Change errorPolicy to "none". Now both will be populated.

@apollo/client version

3.11.4

@jerelmiller
Copy link
Member

Thanks for the report @gbettencourt!

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!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants