This repository has been archived by the owner on Apr 13, 2023. It is now read-only.
notifyOnNetworkStatusChange does not work after an error occurs #2926
Labels
bug-upstream
Bug confirmed to originate from a dependency
has-reproduction
❤ Has a reproduction in a codesandbox or single minimal repository
Intended outcome:
In the above example I have some code in my actual presentational component that does error handling and displays a button that will call
data.refetch()
when pressed. When a network error occurs and then you tap said button, I would expectrefetch
to be called and fordata
to be logged with anetworkStatus
of4
(when it's refetching), and then a second time once the response comes back with anetworkStatus
of7
(when it gets a response and is ready).Actual outcome:
When I actually tried this out, I did not receive the first console log statement I expected. Instead I only got notified of the
networkStatus
of7
response.One interesting thing to note is that when the network request is successful and I try to refetch, it will log out the responses I was expecting in the error scenario.
Another interesting note is that I'm able to get the expected console log statements with the
networkStatus
of4
while refetching if there is a network error, I havenotifyOnNetworkStatusChange
set totrue
AND I have anerrorPolicy
ofall
. However, setting thiserrorPolicy
has other side effects and I don't think it should be necessary to set anerrorPolicy
andnotifyOnNetworkStatusChange
option just to get notified of network status changes....How to reproduce the issue:
If I get time I will add the reproduction using the error template, but you should be able to reproduce by using any HOC query with a similar format as mine listed above, and then forcing a network error and trying to refetching. When you attempt a refetch after an error response then you never get notified of the
networkStatus
changing to4
.Version
The text was updated successfully, but these errors were encountered: