Find Flow.collectAsState() calls — prefer collectAsStateWithLifecycle()
ProprietarycollectAsState() keeps collecting whenever the composition is alive, including while the host activity is stopped. collectAsStateWithLifecycle() (from androidx.lifecycle:lifecycle-runtime-compose) ties collection to the lifecycle owner, dropping subscription while in the background and freeing the upstream Flow from doing work nothing will display.
org. openrewrite. kotlin. compose. FindFlowCollectAsState$KtRecipemod run . --recipe= 'org. openrewrite. kotlin. compose. FindFlowCollectAsState$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.