callback is invoked correctly. However when I perform a configuration change the `onValueChange`callback is invoked again (before the recomposition is invoked). This time with wrong values. The selection is cleared.
When I use a
remembersaveable
it works more or less. It seems the selection is restored with the correct values (even though the context menu on the text is missing). It seems it simply doesn't update it before the recomposition.
Since my state is more complex I store the value in my
ViewModel
. Of course the value get's updated with the wrong state before the recomposition.
Any ideas how to solve this? Or is it a bug?
jannis
10/25/2021, 10:44 AM
My wild guess would be that the focus is cleared and the selection is removed on the orientation change.
jannis
10/25/2021, 1:26 PM
I'm now using a simple workaround: I check the current Lifecycle state and only update the value if the app is resumed.