setup with a number of screens. Following the examples provided by Jetpack, I have it all working. However, I've noticed that when I click on an item in one of the screens (which trampolines to another), that the composable function for that next screen gets called up to 5 times. I've printed out the values being provided into that function, and none of those change.
Any ideas why it's recomposing so many times?
s
Stylianos Gakis
07/24/2023, 8:56 AM
Is the new screen animating in? If yes, it’s perfectly normal to recompose many times as it’s coming into the screen.
j
Jerry Johns
07/24/2023, 3:57 PM
Ah ok. The problem right now is that it's resulting in a fair bit of UX jank/jerkiness, and I suspect that it's because of those recompositions.
Jerry Johns
07/24/2023, 3:57 PM
Any suggestions on how I could go about debugging this further?
s
Stylianos Gakis
07/24/2023, 3:59 PM
If the recompositions happen simply because it’s animating in, I don’t think there’s anything to debug, it works as expected.
If the fact that your composable recomposes 5 times means that it has real visual stutters it must mean that something else is wrong with it, 5 recompositions really aren’t a lot. Also optimally, most of the children of that screen should skip recomposition if no data changes.
You could start by showing a video of what you mean by “janky” and how you are sure it’s the navigation library which is bringing in this jankiness.