0.2.0
Pre-release
Pre-release
- Behaviour changing fix: The
ViewModelProviderFactory
now returns a new ViewModel instance every timecreate()
is called instead of using the same instance over and over again. This is actually the intended behaviour as the AndroidViewModelProvider
takes care of caching instances for us and when callingcreate()
we really always want a new instance.
This can change behaviour in your apps quite dramatically if you depend on the ViewModel being retained even after the Fragment/Activity has been (not by orientation change!) destroyed (but the application process is still living).
Additional clearing handling of ViewModels should thus not be necessary anymore. If you want to reset your ViewModel during the lifecycle of a Fragment/Activity use Fragment/Activity.viewModelStore.clear()
.
There will be more thorough documentation on resetting ViewModels later on in this repository.