You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Is your feature request related to a problem? Please describe.
It's related to usability and improving of lifecycle.
WhenActivated happens too late on the VM/View cycle to start performing operations, such as loading data at VM level, setting up bindings in the view. The order of execution can be seen here:
Due to the late WhenActivated execution as stated above, for my case I exposed a ViewModelDidBind, which is a simple this.WhenAnyValue(v => v.ViewModel) exposed on my view base, so there I can start invoking commands, earlier. It does execute only once, when the viewmodel is set on that view instance, that differs from the OnAppearing and the WhenActivated cause both will be executed every time the view/viewmodel gets displayed. The ViewModelDidBind works for my purpose of starting things earlier in the flow (gets executed right after the view constructor) as follows:
View ViewModelDidBind: 705 milliseconds
Describe the solution you'd like
For performing operations/bindings I'd say I could start them right away when the view/viewmodel is added to the stack, that is a good earlier moment to setup things.
Describe alternatives you've considered
Describe suggestions on how to achieve the feature
What I can think right away is to expose a (potentially new) interface on Sextant and then to call it accordingly when adding that into the stack, and then let the view/viewmodel that's interested on it to implement that interface that would have that new "hook". Knowing it's being "initialized" it could perform the needed operations accordingly.
Additional context
The text was updated successfully, but these errors were encountered:
Is your feature request related to a problem? Please describe.
It's related to usability and improving of lifecycle.
WhenActivated
happens too late on the VM/View cycle to start performing operations, such as loading data at VM level, setting up bindings in the view. The order of execution can be seen here:WhenActivated
execution as stated above, for my case I exposed aViewModelDidBind
, which is a simplethis.WhenAnyValue(v => v.ViewModel)
exposed on my view base, so there I can start invoking commands, earlier. It does execute only once, when the viewmodel is set on that view instance, that differs from theOnAppearing
and theWhenActivated
cause both will be executed every time the view/viewmodel gets displayed. TheViewModelDidBind
works for my purpose of starting things earlier in the flow (gets executed right after the view constructor) as follows:Describe the solution you'd like
For performing operations/bindings I'd say I could start them right away when the view/viewmodel is added to the stack, that is a good earlier moment to setup things.
Describe alternatives you've considered
Describe suggestions on how to achieve the feature
What I can think right away is to expose a (potentially new) interface on Sextant and then to call it accordingly when adding that into the stack, and then let the view/viewmodel that's interested on it to implement that interface that would have that new "hook". Knowing it's being "initialized" it could perform the needed operations accordingly.
Additional context
The text was updated successfully, but these errors were encountered: