react-apollo-hooks
react-apollo-hooks copied to clipboard
`useQuery` doesn't work correctly if `variables` is set to `undefined`
... but it works okay if it is set to an empty object ({}).
Issues that happen when you do variables: {}:
-
https://github.com/trojanowski/react-apollo-hooks/issues/140
-
Our case:
Have a hook like
const response = useQuery<Data>(QUERY, {
fetchPolicy: 'cache-first',
});
If you call it for the first time, it gets the data from network and everything is ok.
But if you unmount and mount the component, then data is set properly (to the cached version), loading correctly is false, but networkStatus is 8 (NetworkStatus.error), even though error and errors properties are undefined.
Happens on both 0.4.5 and 0.5.0 .