apollo-client
apollo-client copied to clipboard
fetchPolicy cache-and-network makes loading get updates on refetch
Intended outcome:
loading
should not be updated when calling refetch. Even when using fetchPolicy cache-and-network
Actual outcome:
loading
became true again when calling refetch. This is the behaviour without a specified fetchPolicy. (And no notifyOnNetworkStatusChange
specified)
How to reproduce the issue: https://codesandbox.io/s/elastic-dan-r056e3?file=/src/index.jsx:461-498 You can comment the fetchPolicy line and see loading is not shown when refetching.
Versions See sandbox, started from sandbox template.
@EvertEt 👋 this problem might be covered in this issue https://github.com/apollographql/apollo-client/issues/10105, could you check it out and let us know?
@jpvajda To me it seems to be a different issue but I am not very experienced with apollo yet.
#10105 is closed but the problem persists in last version
I think current loading behaviour is ideal as we are refetching latest data.
I am seeing the same issue in our app. With no data changed, the component still got updated twice when calling refretch
. This is only happening with the cache-and-network
fetchPolicy. We are using the Apollo client 3.7.16. The latest 3.9.8 also has this problem.