In my scenario, i have a app with navigation view. navigation view holds multiple navigation item. each navigation holds its own Page. Each page contains its own viewmodel. The Viewmodel contains multiple objects. The ViewModel is responsible for hitting an API and process its response to the objects.
In my case, If the navigating the page faster then Page 1 opens API 1 triggers (response not yet received) then Page 2 opens and API 2 triggers (response not yet received) and continues. In such case, when the API 1 response is returned after some time, all the objects in my viewmodel is cleared (viewmodel data was cleared on page navigation to next page) and hence the exception is thrown.
My question is, if i navigate to another page, am i able to stop the API call of my last page or kill it without returning back to viewmodel ?