I have a problem combining pagination, prefetching, and refetching of data using Apollo with Angular 2. My intended behaviour in the app is that there never should be any difference in data between the server and the client. I want to reduce loading time for the user by prefetching data onmouseover in the menu and have a spinner/loading screen in every component that hides the content until the data has been fetched. If a component already have been visited I want to trigger a refetch instead of a prefetch onmouseover so that the the client matches the server.
Today if I navigate to a component and paginate to, for example, the third page which shows that set of data and after that navigate to another component and then back to the first component again (before fetching of the new data is done) I get the cached data from the third page which trigger the spinner to hide and the wrong dataset to show for one/a couple of seconds before the subscribe gets the "right" data.
My question is: Is there any way to clear/control the cache of a specific query/watchQuery so that I'm always sure to not show cached data in the client?