j

    james

    1 year ago
    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
    Filip Wiesner

    Filip Wiesner

    1 year ago
    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.