How to handle state serialization? #984
-
|
I am pretty confused by the state serialization. When the app is run from background, it just initializes the current stack purely based on configurations. So that would mean, that everything has to be For example I have a stack where user configures the data object to be created in several steps.
Sorry if it's a dumb question, maybe I just missed something in the docs or something. I am just wondering what is the "intended" way to handle this sort of stuff with decompose. |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 2 replies
-
|
The idea is to treat component configurations as navigation arguments. Configurations should contain minimum amount of data required for component creation. The rest can be passed via constructors. In your example however, you don't pass any data into child components. You accumulate data from multiple steps and use that after the final step confirmation. So you should either make Another possible way is to have |
Beta Was this translation helpful? Give feedback.
The idea is to treat component configurations as navigation arguments. Configurations should contain minimum amount of data required for component creation. The rest can be passed via constructors.
In your example however, you don't pass any data into child components. You accumulate data from multiple steps and use that after the final step confirmation. So you should either make
DataDraftserializable and save it viaStateKeeper(e.g. by using thesaveable {}extension function), or carry properties with child configurations. I.e. addproperty1toStep2and addproperty1andproperty2toConfirm. You may notice that the second option duplicatesproperty1inStep2andConfirm. They both …