Find scope.launch { … } calls inside a @Composable body

Proprietary

scope.launch { … } in a @Composable body starts a new coroutine on every recomposition — none of them get cancelled until the scope dies. Use LaunchedEffect(key) { … }, which is automatically cancelled and restarted by the composition's lifecycle.

org.openrewrite.kotlin.compose.FindCoroutineLaunchInComposableBody$KtRecipe
mod run . --recipe='org.openrewrite.kotlin.compose.FindCoroutineLaunchInComposableBody$KtRecipe'

Install it once from Recipe actions, then run it on every repository under the current directory. New to the Moderne CLI? Set it up.