:wave: Since strong skipping mode is enabled by de...
# compose-android
h
👋 Since strong skipping mode is enabled by default, does it make sense to use the
@Stable
annotation anymore? From docs: > With strong skipping enabled, all restartable composable functions become skippable. If I understand it correctly, almost all functions are restartable. So, when should I use
@Stable
now, since Kotlin 2.0.20? Thank you 🙏
1
m
If you want unstable params to be compared using structural equality
equals
instead of instance equality (
===
)
c
Been using compose for like 5 years. I've never used @stable annotation 🙈
👍 1
h
@MR3Y Does it matter now if all restartable functions become skippable?
m
@hawklike if you have a function that takes an unstable parameter, and then this parameter value changed to a different instance but it has the same content, then your composable function won't skip and it'll recompose even if strong skipping is enabled. By using
@Stable
here in this case, you make a contract with the compiler that this parameter's value should be considered the same unless its structure/content changes (Assuming also you're correctly adhering to
equals
contract). but in practice, this is kind of premature optimization IMO and you don't need it until you start to see signs of degraded performance due to recompositions.
💯 3
thank you color 1