Skip to content
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

[Enhancement] Add an async initialization to Regions #3244

Open
ramtechjoe opened this issue Aug 29, 2024 · 1 comment
Open

[Enhancement] Add an async initialization to Regions #3244

ramtechjoe opened this issue Aug 29, 2024 · 1 comment

Comments

@ramtechjoe
Copy link

Summary

The current API has an IInitializeAsync which provides a convenient way to run async code during page initialization. However, there does not exists a similar implementation pattern if async initialization is needed for a region ViewModel

API Changes

Could possibly add an IRegionAwareAsync interface which implements:

IRegionAwareAsync
{
    Task OnNavigatedToAsync(NavigationContext navigationContext)
}

This would need a supporting call from the MvvmHelpers class

Intended Use Case

Provide a clean approach to implementing async code during initialization of a region view model

@dansiegel
Copy link
Member

@ramtechjoe there are 2 ways to implement this:

  1. We wait for the task before loading the view.. this would lead to a really awful user experience
  2. We invoke this after the view loads. I'm unclear how this would really be of any benefit to you besides hiding async void. Keep in mind that these methods are effectively method handlers and async void is actually ok here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants