Reputation: 891
I'm trying to implement blazor prerendering. It seems to work fine, but when I refresh the page, the layout (The container of the actual routed page) is not visible. I followed the instructions here https://jonhilton.net/blazor-wasm-prerendering/ and created a _Host.cshtml file in the Server project. But the Client/App.razor which is looking as follows is not included:
<Fluxor.Blazor.Web.StoreInitializer />
<Router AppAssembly="@typeof(App).Assembly">
<Found Context="routeData">
<AppRouteView RouteData="@routeData" DefaultLayout="@typeof(MainLayout)" />
<FocusOnNavigate RouteData="@routeData" Selector="h1" />
</Found>
<NotFound>
<PageTitle>@Frontend.ErrotPage_NotFoundTitle</PageTitle>
<LayoutView Layout="@typeof(MainLayout)">
<MudAlert Severity="Severity.Error" Variant="Variant.Filled" Square="true" Class="ma-2">@Frontend.ErrorPage_NotFound</MudAlert>
</LayoutView>
</NotFound>
</Router>
Do I have to move this file to the Server project, or what is the right way to accomplish this?
Upvotes: 1
Views: 293
Reputation: 891
Seems like the layout was rendered already. But the parts of it were not rendered since it was depending on the current user which was not available on the server side. The solution will be to provide the current user also on server side (Which is not yet possible with Blazor 6).
Upvotes: 0