-
Notifications
You must be signed in to change notification settings - Fork 772
Fix activation for nested conductor / screen scenarios #898
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
If the next release is 5 then it would also be ok to rename the methods. (OnActivate and OnInitialize) |
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 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 was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good. Could you please update the Feature apps with the change
Yinimi/merge all
@vb2ae I updated the Feature branch. |
@Yinimi thank you the samples do need help. |
There seems to be a related issue #906 |
@Yinimi I will look at it |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you for finding this
@@ -39,12 +39,13 @@ object IHaveActiveItem.ActiveItem | |||
/// <returns>A task that represents the asynchronous operation.</returns> | |||
protected virtual async Task ChangeActiveItemAsync(T newItem, bool closePrevious, CancellationToken cancellationToken) | |||
{ | |||
var previousItem = _activeItem; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good find
Maybe a 'state' like connection is better. Just whether one is activated or not expresses too little meaning. For example, "In Progress" indicates that it is activating. For CM.v5, the func name 'activating' and 'Activated/AfterActivated' is better. We don't need 'Active' means it is being activated. |
@a44281071 could you create an issue for the requested change? |
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.