apollographql / react-apollo

:recycle: React integration for Apollo Client
https://www.apollographql.com/docs/react/
MIT License
6.85k stars 787 forks source link

reFetchObservableQueries doesn't change networkStatus/loading #3981

Open ivansky opened 4 years ago

ivansky commented 4 years ago

How to reproduce the issue: https://codesandbox.io/s/test-refetch-t0izv

Reason to use reFetchObservableQueries() is to pass proper Accept-Language when it's changed. And while it's loading I would like to show user that data is changing from one language to another. Now after changing language data is flicking with delay without any sign of loading. It's bad UX.

useOnChangeLanguage(() => {
  client.reFetchObservableQueries();
});

If example with language change is needed, I can create it, but it won't add more presentative example. Reproduce repo might be enough.

Intended outcome: when reFetchObservableQueries is called at least networkStatus should change from 7 (ready) to something else, e.g. 4 (refetch)

Actual outcome: always

loading: false
networkStatus: 7