I am trying to save state of a dialog on configura...
# compose
k
I am trying to save state of a dialog on configuration change, but lambdas are giving me an issue during serialization. How do you guys handle custom dialog states during configuration change?
z
Is this a Jetpack compose question? You can simply remember the state
t
i assume you want to save and restore your dialog model within your ViewModel, right? you should only save the UI State (the information that is necessary to restore the UI) and not the action that correspond to certain UI Elements. So instead of having a lambda within your dialog model, consider using some declarative abstraction of that action, this can be a enum or a sealed class. your dialog model could look like this:
Copy code
DialogModel(
    title = "Confirm", 
    action = DialogAction.Confirm
)
k
Thank you!