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
I am then running a lazy query where I pass in an invalid query variable which causes the server to return an error (this works in the explorer all ok.
When I click the button to trigger my query, it casues the apollo client error to be thrown. I would expect the error from the server to be surfaced from useLazyQuery.
Note Apollo Client throws an error complaining it can't read property data of undefined.
Screen.Recording.2023-09-26.at.11.56.01.mov
I have also tested this same query using the useQuery hook and it just seems to show loading: true the whole time, rather than returning an error. I would expect an error to be returned form the useQuery hook.
Any help in understanding this issue with surfacing the correct error would be greatly appreciated. Thanks
The text was updated successfully, but these errors were encountered:
This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.
For general questions, we recommend using StackOverflow or our discord server.
Issue Description
When using
useLazyQuery
and I expect an error to be returned from the server, ApolloClient appears to crash as it can't readresult.data
.You can see in the code, I am using SpaceX's API: https://spacex-production.up.railway.app/
I am then running a lazy query where I pass in an invalid query variable which causes the server to return an error (this works in the explorer all ok.
When I click the button to trigger my query, it casues the apollo client error to be thrown. I would expect the error from the server to be surfaced from
useLazyQuery
.I am using
node 20
"@apollo/client": "^3.8.4",
Link to Reproduction
https://github.com/stretch0/apollo-client-native-sandbox
Reproduction Steps
Setup app
Using node v20
Once app loads, click the
PRESS ME
button.Note Apollo Client throws an error complaining it can't read property
data
of undefined.Screen.Recording.2023-09-26.at.11.56.01.mov
I have also tested this same query using the
useQuery
hook and it just seems to showloading: true
the whole time, rather than returning an error. I would expect an error to be returned form theuseQuery
hook.Any help in understanding this issue with surfacing the correct error would be greatly appreciated. Thanks
The text was updated successfully, but these errors were encountered: