-
Notifications
You must be signed in to change notification settings - Fork 23
Composable AndroidView update
block is run on every key press
#856
Comments
update
block is run on every key pressupdate
block is run on every key press
I think this is actually working as expected (although we didn't expect it to work like that 😅 ): looking at the source code, we can see the
By using a As for why there were different behaviours after a clean build and an incremental one, I have no idea. It might be a compiler bug. |
I thought the |
My theory was the |
With Android Studio Hedgehog we're able to debug the reasons for recomposition and it looks to be caused by the The only difference seems to be that we're passing a function reference. Replacing it with a lambda seems to make the issue go away but I have no idea why. |
Problem
The
update
block of the composableAndroidView
is run on every key press, whereas it should only run when a variable used inside the block is changed.This block is supposed to run any time the style or callbacks are changed and isn't optimised to be run very frequently.
AndroidView
still recomposed on every key press.Proposed solution
Workaround implemented in #854
No solution is known.
The text was updated successfully, but these errors were encountered: