I have an ASP.NET Core 6.0 WebAssembly in which I have included a Razor class library. The library contains several components, including three that use the @page
directive. After a login (implemented with IdentityServer4) it is directed to one of the routable components from the library. The problem: the component is not displayed...
I checked the following:
App.razor
I added AdditionalAssemblies="new[] { typeof(Helper).Assembly, typeof(Confirmation).Assembly, typeof(HelperRegistration).Assembly }"
.I found the following:
protected async override Task OnInitializedAsync()
of the routable component is called.I tried this:
StateHasChanged()
method of the layout component from the OnInitializedAsync()
method. The idea behind it was that
Trigger rendering of the component from the library.The components in the Razor class library were previously implemented directly in the Blazor WebAssembly and that's how it all worked! My goal is to integrate the library later with lazy load.
I found the mistake. It wasn't the display of components, it was the way I integrated the navigation menu. This was not displayed as I expected, but it was correct that no component was displayed at that moment.
The hints helped me to find the cause of my error. Thank you!