Quantcast
Channel: Active questions tagged blazor - Stack Overflow
Viewing all articles
Browse latest Browse all 4839

RenderMode.InteractiveServer call OnInitializedAsync() twice - how can I avoid all that processing twice?

$
0
0

I have been using

<component type="typeof(HeadOutlet)" render-mode="Server" />

However, the latest version of DevExpress requires:

<Routes @rendermode="@RenderMode.InteractiveServer"/> 

Which I assume I can do as:

<component type="typeof(HeadOutlet)" render-mode="ServerPrerendered" />

The new .NET 8 code sample appears to have no _Host.cshtml and defines all this a little different. But I can use the old _Host.cshtml+App.razor approach and don't need to conver to the new Routes.razor+App.razor - correct?

This all works fine for me - but asking to confirm that it should, as opposed to somehow I'm lucky and a change will break my code.

And my big question is as follows. When I switch to ServerPrerendered, it then calls OnInitializedAsync() twice. This is a big hit on the database on a lot of my pages. So it will take twice as long for the pages to render.

Is there any way to avoid this? Or are we stuck with slower pages if ServerPrerendered is used?


Viewing all articles
Browse latest Browse all 4839

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>