If I have a single (complex) state in a VM and I observe it from my Composable: all the views that observes any property of this state will always be recomposed on any emission or compose somehow is capable to discover that only a single piece of that state changed (with some sort of diff)? I'm not sure how to debug a recomposition, tips are welcomed! 🤔
m
mkrussel
12/01/2021, 2:03 PM
My understanding is the function uses the state object will be recomposed, but if you pass parts of the state to other composable functions, those will only be called if the arguments to them changed.
👍 2
s
Stylianos Gakis
12/01/2021, 2:03 PM
Compose is in fact “smart” enough to not recompose part of the UI if it doesn’t need to, but only the composables that read the changed state. Take a look at this https://www.jetpackcompose.app/articles/donut-hole-skipping-in-jetpack-compose if you’d like! I Hope it covers what you asked if I understood your question correctly.
👍 2
m
Marcello Galhardo
12/01/2021, 2:10 PM
Thank you for the quick reply folks, I appreciate! 🤗
FYI, the article is exactly what I was looking for - thank you for sharing @Stylianos Gakis!