sellmair / kompass

Kotlin Multiplatform Router for Android and iOS
MIT License
345 stars 13 forks source link

Keep state on Process-Death #4

Closed fablue closed 5 years ago

fablue commented 6 years ago

Kompass doesn't keep the current state on process-death. Routing to a certain destination, terminating the app, re-opening will lead route to the last destination. This could be changed by separating lambdas and destinations from inside the backstack and serializing the backstack to the onSaveInstance bundle.

youfacepalm commented 6 years ago

Should the size limit of the bundle need to be considered when you go through this approach?

Related SO Question

fablue commented 6 years ago

Hey, thanks for the comment! Honestly, I didn't even know about this issue =/

Currently, I think we should not care 🤔 If you are passing such big data to your destination, then maybe the approach of bundles itself is not correct.

I personally think one should just pass a list of id's to bundles/Destinations not the complete list of objects itself and that the ViewModel is responsible for getting the data later.

But I also think that it would be pretty cool if the library (later on) could handle such a case! The only thing is:

I am pretty proud, that Kompass could theoretically be used with fragments/activities that do not know about Kompass, because it put's the arguments into the bundle like a human would do it too (and should later be more configurable). We would break this feature/idea when we do not implement it correctly?

@youfacepalm What do you think: How important is this issue? 🤔

youfacepalm commented 6 years ago

@fablue What you said makes sense. I think focusing on state retention during process death should be the top priority for now.

Great library btw 👍

sellmair commented 6 years ago

@youfacepalm I am glad you appreciate it 😌