Our presenters do not retain state. You're free to...
# squarelibraries
j
Our presenters do not retain state. You're free to hook up the regular save instance state stuff like Compose UI does though.
s
Copy code
var count by remember { mutableStateOf(0) }
This is state in the presenter, right? Do you just mean once the UI has been navigated away from it, all state is lost?
You’re free to hook up the regular save instance state stuff like Compose UI does though
I haven’t tried this is compose multiplatform yet. I’ll look into it. Thanks
j
That is state, but it's not retained across recreation
You would need to use rememberSavable or whatever
s
I haven't used Molecule yet, but I'd assume that values saved using
remember
will be remembered during the lifecycle of your presenter. It's upto you how you manage/retain your presenters.
what jake said
Can
rememberSaveable
be used from molecule? If yes then I'd imagine they're saved in the same way as Compose UI -- by hooking into a state registry owned by your app.
j
Yes but you have to hook it up yourself. We don't do anything with it.
p
Why do your presenters never retain state?
s
are you asking why is state not retained across presenter recreations?
p
Yes
For example say we have a form, user adds something, leaves the app to find some date he needs, system kills app, user returns.
s
he they need I imagine those form values will be retained by your UI and not your presenter
j
Yep. That's done at the UI layer.