https://kotlinlang.org logo
#compose
Title
# compose
m

Matej Drobnič

02/06/2020, 12:45 PM
Is there any documentation out on how compose handles state saving (for both configuration changes and process death)? I'm mostly curious about various state objects that are arbitrary classes and thus cannot be parcelized into saved state bundle.
a

Andrey Kulikov

02/06/2020, 12:47 PM
this feature is WIP atm. it is not yet implemented thus no documentation is available
👍 1
k

kioba

02/06/2020, 1:54 PM
configuration changes can be handled without killing the Activity. Last time we checked with
@AdamPowell
mentioned that an annotation
@ComposeActivity
might be only what we need on a composable function. And the Activity will handle config changes and triggers a recompose.
process death
is a fascinating one. Are there any discussions around this outside of the “official docs”?
a

Andrey Kulikov

02/06/2020, 3:24 PM
@kioba not sure what discussions do you mean?
we will support saving and restoring composable local states into SavedInstanceState in some way(the final api is to be defined). so things like scroller position will survive both screen rotation and process recreation. aside for it we will probably recommend disabling activity recreation for screen rotation via the manifest for the purely composable powered activities. given we will support interop with the regular Android Views this would not be a default behavior now
k

kioba

02/07/2020, 9:32 AM
I was referring to solving the
SavedInstanceState
, I wasn’t sure if compose will initiate changes how we handle or just a cleve mechanism on top of SavedInstanceState.
saving and restoring composable local states into SavedInstanceState in some way
sounds like a callback on every state objects which makes senses.
5 Views