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

smoothie lifecycle extension does not provide example for combining ViewModel with SavedStateHandle using AbstractSavedStateViewModelFactory #410

Open
Zhuinden opened this issue May 30, 2020 · 1 comment
Milestone

Comments

@Zhuinden
Copy link

Zhuinden commented May 30, 2020

In order to support onSaveInstanceState and saved state persistence inside ViewModel classes, Jetpack provides the viewmodel-savedstate module: with the AbstractSavedStateViewModelFactory, that provides the correct SavedStateHandle for the SavedStateRegistryOwner, with the correct initial arguments (intent.extras, fragment.arguments, or navBackStackEntry.arguments).

There seems to be no example for this basic scenario in this library, and that is a problem.

The viewmodel-savedstate module was officially released as a stable release in January 2020, and should be supported.

@dlemures
Copy link
Collaborator

Hi @Zhuinden ,

Thanks for the issue! I agree that it is something that we should support. Planning to add it to the next release.

Implementation notes:

  • We just need to update androidx.fragment:fragment dependency to 1.2.0
  • The rest of the code is ready for this change

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants