Skip to content

Await for OnInitializedAsync completes #32

Open
@PhotoAtomic

Description

Hello, I've a scenario where my template receives a service via dependency injection
this service in turn performs an async operation.

the idea is to call the async operation in the OnInitializedAsync method of the page/component/template which will populate the asynchronously received data that the page will finally display once ready

I've seen that BlazorTemplater correctly invokes the OnInitializedAsync method (as well as all the other Async lifecycle method) but unfortunately the "render" phase appears to occur immediately without waiting the async methods to complete; So my data are not contained in the produced html.
Looks like there are no method to "RenderAsync" or am I wrong?

Do you have any ideas/plans on how to achieve this?
Basically what I would like to have is a RenderAsync Method that returns only when all the "Async" lifecycle methods of the component have completed and therefore provides the "final" html populated with all the values obtained from these async services.

-Of course I could invoke the service externally, obtain the values and then pass as parameter to the page, but I would prefer the other way because that allows me to reuse the template as normal page in my application (providing me to preview it to the user for example, before transforming it in a HTML string that I then transform in a PDF or I can email: preview is a cool feature!)

Any idea?

Metadata

Assignees

Labels

enhancementNew feature or request

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions