Hello! When `rememberScrollState` is used inside `...
# compose
a
Hello! When
rememberScrollState
is used inside
Crossfade
, it receives different generates keys every time the screen is rotated. This prevents the state from being restored and also causes more and more keys accumulating in the
UiSavedStateRegistryAmbient
. Is it expected behaviour or a bug?
Same for
rememberLazyListState
l
@Andrey Kulikov
a
hey! what objects are you using as keys for crossfade?
add far as I remember currently the hashCode of this object you passed to Crossfade is used for generating the final key. seems like your hashCode is changing after the rotation. when we will have Navigation library handling screen changes instead of Crossfade we will have a chance to make it more clear
­čĹŹ 2
a
Yes it is changing, keys are just normal classes. Implementing hashCode fixed the issue, thanks!
Would be nice to add some sort of
keySupplier
to
Crossfade
. In my case objects contain another objects that do not implement equals/hashCode . So making them data classes has no effect.