If I have a suspend function with some important long running code, and want to trigger it from a co...
j
If I have a suspend function with some important long running code, and want to trigger it from a composable function, what is the standard way to start this long running function so that it is not cancelled when the component recomposes? Not clear on how to use the effect stuff for this
f
Both
rememberCoroutineScope()
and
LaunchedEffect
should work but if it's really long running, I'd suggest triggering the function from somewhere else like ViewModel or similar.
👍 2