Skip to content

0.2.0

Pre-release
Pre-release
Compare
Choose a tag to compare
@ubuntudroid ubuntudroid released this 05 Dec 13:56
· 76 commits to develop since this release
4a21199
  • Behaviour changing fix: The ViewModelProviderFactory now returns a new ViewModel instance every time create() is called instead of using the same instance over and over again. This is actually the intended behaviour as the Android ViewModelProvider takes care of caching instances for us and when calling create() 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.