I currently have a flat compose navigation hierarchy, and when navigating from the 'home' screen to another screen, any hot flows tied to the viewModelScope of the 'home' screen will continue to operate as expected. I want the viewModel to stay alive, but I want the flows paused while not inside that composable, so I load/dispose them inside the 'home' composable via a DisposableEffect with job cancellation. Is there a more sensible way to handle this?
1 year ago
There's a lot to unpack here. A hot flow is, by definition, always going, so there's no such thing as 'pausing' it. If you're using something like
, then it sounds like you should be using
, which would automatically stop the upstream collecting when your