Find bare mutableStateOf(...) inside @Composable without remember { }

Proprietary

A bare mutableStateOf(...) call inside a @Composable allocates a fresh MutableState on every recomposition, throwing away the previous value. Wrap in remember { mutableStateOf(...) } so the snapshot survives recomposition (or hoist into a ViewModel if it needs to survive process death).

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