Open stubailo opened 5 years ago
BTW happy to work on this if we think it's good behavior!
I am facing a similar issue. Have set of tabs where each tab open makes a network request. If i have open a tab and switch tab, the network call is made but when I come back to the same tab, the data isn't updated. The Query component unmounts after making a Query, which let's it unsubscribe and hence apollo doesn't updates cache.
Intended outcome:
I'd like to be able to take some action, call
refetch
on a query, unmount the Query component right away, and still have the cache update.Actual outcome:
Right now, the
queryId
is cleaned up as soon as the ObservableQuery has no subscribers, which means that when the refetch result comes back from the server, it is ignored. So that means when you come back to that view in the UI, you still see the old data even though we sent a request to the server and got a response for it.How to reproduce the issue:
Should be easy to write a failing test like so (happy to do it):
Basically, the test checks if the
refetch
updated the cache to the new server state (right now it doesn't)Versions