I'm trying to diagnose why some composables are ge...
# compose
t
I'm trying to diagnose why some composables are getting recomposed more often that I expect. Is there an easy way to diagnose what triggers the recompose using a tool like layout inspector?
f
Never tried it but you can check out Rebugger from @theapache64
❤️ 1
j
See https://developer.android.com/jetpack/compose/tooling/layout-inspector#recomposition-counts There is more tools but a good start :) Also if using Android Studio Hedgehog should see recomposition state values in real time as well :)
t
+1 for Rebugger 😛
😀 2
t
Thanks for the suggestion. Unfortunately this is Compose multiplatform and rebugger isn't a drop in for common code.
I moved my code to use the expect/actual pattern and I used Rebugger. Does having more than one thing change cause the recomposition to change the number of times as the things that changed? I posted a code snippet with my log output in the main channel. Rebugger confirmed that two things changing caused two recompositions of the function. I expected only one recomposition that changed both parameters at once.
z
Your expectation is correct. Something else must be going on. Hard to say without seeing any code
👍 1
t
I figured it out. I was updating a remembered variable that changed based on the flow. That was causing the extra recomposition. Thanks for all the help!
👍 1
👍🏻 1