mrmans0n / compose-rules

Lint rules for ktlint/detekt aimed to contribute to a healthier usage of Compose. Actively maintained and evolved fork of the Twitter Compose rules.
https://mrmans0n.github.io/compose-rules
Other
550 stars 21 forks source link

Add LambdaParameterInRestartableEffect rule #187

Closed mrmans0n closed 7 months ago

mrmans0n commented 7 months ago

Adds a rule to detect potential troubling scenarios where a lambda parameter in a composable is used directly in a restartable effect (e.g. LaunchedEffect/DisposableEffect), without using rememberUpdatedState or using the param as a key to the effect.

This currently bit me in the ass at work, so adding a basic rule for just lambdas (for now) to tackle this.

AfzalivE commented 3 months ago

Will this be needed even with strong skipping?

mrmans0n commented 3 months ago

Yep!