Find mutableStateOf(...) stored in a class field

Proprietary

private val x = mutableStateOf(...) at class scope ties the state to the lifetime of the enclosing class — ViewModel scope is fine, but UI-layer classes shouldn't be holding state for the composable. Hoist into a ViewModel or accept the state from the caller via parameters so recomposition and lifecycle agree on ownership.

org.openrewrite.kotlin.compose.FindMutableStateInClassField$KtRecipe
mod run . --recipe='org.openrewrite.kotlin.compose.FindMutableStateInClassField$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.