apollographql / apollo-client

:rocket:  A fully-featured, production ready caching GraphQL client for every UI framework and GraphQL server.

Home Page:https://apollographql.com/client

Repository from Github https://github.comapollographql/apollo-clientRepository from Github https://github.comapollographql/apollo-client

Fix inconsistency with `networkStatus` between emitted result and `getCurrentResult` for `errorPolicy: 'all'`

jerelmiller opened this issue · comments

When errorPolicy is all, there is a discrepancy between the emitted value and observableQuery.getCurrentResult(). At times getCurrentResult() will report the networkStatus as ready when errors are set on the result, whereas the emitted result sets networkStatus to error. This is due to the check in getCurrentResult which uses queryInfo.networkStatus if available.

We need to determine the correct behavior here and ensure both values match. I lean toward networkStatus as error being the correct value since there is an explicit condition that checks for the presence of errors and errorPolicy to update the networkStatus accordingly.


NOTE: I am able to reproduce this behavior by updating useQuery to use the result passed to the onNext function rather than calling getCurrentResult.

Do you have any feedback for the maintainers? Please tell us by taking a one-minute survey. Your responses will help us understand Apollo Client usage and allow us to serve you better.