Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

State loss #28

Open
nhaarman opened this issue Sep 4, 2018 · 1 comment
Open

State loss #28

nhaarman opened this issue Sep 4, 2018 · 1 comment
Labels
priority:low This issue has a low priority type:broken Unwanted undefined behavior type:needs-design Uncharted territory

Comments

@nhaarman
Copy link
Owner

nhaarman commented Sep 4, 2018

State loss can occur when a Scene transition occurs after the Activity has called onSaveInstanceState. If the Activity isn't restored after the transition occurred, the transition is lost and the application will be restored to the point it was in onSaveInstanceState.

Android's FragmentManager throws an exception if a transaction is executed after the state has been saved (commit) and allows you to ignore state loss (commitAllowingStateLoss). Currently, Acorn ignores state loss.

@nhaarman
Copy link
Owner Author

nhaarman commented Sep 4, 2018

A solution could be to create our own state saving mechanism. If no Activity is active and a Scene transition occurs, a new call to the main Navigator's saveInstanceState could be done to avoid losing this state. This would result in an entirely custom state persistence layer just for Acorn.

The solution is more correct though: losing presentation state just because the UI layer isn't present is unwanted behavior. Since the application instance is kept alive when the Activity is gone for a certain period of time, it can be used to do this saving of state until the entire process is being killed.

A potential drawback could be that this state saving is costly when happening for every Scene transition.

@nhaarman nhaarman added type:broken Unwanted undefined behavior type:needs-design Uncharted territory labels Sep 12, 2018
@nhaarman nhaarman added the priority:low This issue has a low priority label Oct 23, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
priority:low This issue has a low priority type:broken Unwanted undefined behavior type:needs-design Uncharted territory
Projects
None yet
Development

No branches or pull requests

1 participant