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 was archived by the owner on Apr 13, 2023. It is now read-only.
How to reproduce the issue:
On any react-apollo application with a Query, force an error to occur and log the data passed to children. I personally encountered this when I had accidentally not had my graphql server running. As a result, the first Query request failed due to a network error, and I got an exception because I was assuming data would be an empty object and not undefined.
Intended outcome:
The data prop passed to the Query component is never undefined. That's my understanding anyways, from reading https://github.com/apollographql/react-apollo/blob/master/src/Query.tsx#L89
Actual outcome:
If your first request for a Query errors, data ends up being null. It ends up hitting this line, https://github.com/apollographql/react-apollo/blob/master/src/Query.tsx#L378, which overwrites the default-created empty object and replaces it with
(this.queryObservable!.getLastResult() || {}).data,, which will be undefined if the query doesn't have a result yetHow to reproduce the issue:
On any react-apollo application with a Query, force an error to occur and log the data passed to children. I personally encountered this when I had accidentally not had my graphql server running. As a result, the first Query request failed due to a network error, and I got an exception because I was assuming data would be an empty object and not undefined.
Version