MvvmCross / MvvmCross-AndroidSupport

Android support library packages for MvvmCross: The .NET MVVM framework for cross-platform solutions.
http://mvvmcross.com
15 stars 0 forks source link

Cached ViewModels (of fragments) don't re-run lifecycle when with a new navigation #194

Open vvolkgang opened 8 years ago

vvolkgang commented 8 years ago

Creating an issue so I don't forget to PR this. If a fragment ViewModel is cached and re-used,it won't re-run the lifecycle with a new navigation.

Problem source

My current solution was to change MvxFragment.OnCreate to also run the lifecycle for the cached one. Need to test this in the sample to figure if something more is required.

This might be related to #112

Steps to reproduce

Need to implement custom code in the sample to repro this.

Expected behavior

ViewModel should run his lifecycle again, receiving the new navigation parameters and updating the view with new info

Actual behavior

Given that the ViewModel is cached and didn't ran the navigation, the view will have the previous info.

Configuration

Version: 4.0.0