Open Yinimi opened 4 months ago
If the next release is 5 then it would also be ok to rename the methods. (OnActivate and OnInitialize) Eventually OnActivate => BeforeActivate, OnActivated => OnActivate (to make things as complicated as possible)
Yes the next release is version 5
I added the obsolete messages
I think #764 Is also resolved with this change
asp.net Blazor use void OnAfterRender()
and Task OnAfterRenderAsync()
for view update. And use void OnInitialized()
and Task OnInitializedAsync()
for init load.
ASP.NET Core Razor component lifecycle:
If I read the build pipeline log correct the android 28 sdk is missing? Is the pipeline running on a specific machine with a build agent? Then it would probably be required to install it there manually
Working on a fix for android version in another branch
There have been some discussions and changes related to when OnActivate() is called.
593 He wanted to use IsInitialized / IsActive to control the visibility of some loading indicator. If the property is set to true before the OnActivate / OnInitialize call it will obviously not be able to use it for determining if the loading has finished.
I can understand the reason for this request but I think a method called OnActivate() should be called after the IsActive is set to true, otherwise Activating or BeforeActivate are better names in my opinion.
Since some devs (like me) want to use OnActivate() to trigger the initializing of the ViewModel there are scenarios where it is problematic if the IsActive is not set yet. I created the ActivateWhileActivateOneLevel() test method to demonstrate it. To provide such a method @erik-hooper added with #859 a OnActivated() method which is called after the property has been set. If I use this method with another test ActivatedWhileActivatedOneLevel() The issue is resolved.
I have a more complicated and nested scenario. example Test
In my app the inner conductor handles the navigation depending on some configuration. The outer conductor handles basic stuff and also the display of the user preferences ("some Page"). If the View 1 now wants automatically to continue after the user preferences have been shown (think of auto login was just enabled) then in this nested scenario the View 2 will not be initialized because all this is triggered by the OnActivate() method of the inner conductor.
With this change the behavior should be like before the changes of #593 where the active item(s) are activated after the conductor has IsActive enabled.
In #789 it was also discussed to add something like BeforeActivate and AfterActivate. I added a OnInitializedAsync() to adress this as well. I didn't touch the OnViewLoaded (it was wished to make this async), this looks more complicated.