Skip to content

How to deal with slow OnInitializedAsync blocking first render? #49170

Closed Answered by davidroth
davidroth asked this question in Q&A
Discussion options

You must be logged in to vote

I investigated this further and now it makes perfect sense.
I used the BlazorServer template which renders the component with "ServerPrerendered". So on the first request the component is rendered on the server and html is returned. Then the app initialises the websocket circuit and renders again using the websocket connection. It is configured in "_Host.cshtml".

This makes it perfectly clear why I see this initial delay when I press "F5" in the browser.
If I change the "render-mode" to "server", the app responds immediately and everything is as expected.

Replies: 2 comments 6 replies

Comment options

You must be logged in to vote
5 replies
@Xyncgas
Comment options

@davidroth
Comment options

@Xyncgas
Comment options

@Runaho
Comment options

@Xyncgas
Comment options

Comment options

You must be logged in to vote
1 reply
@Runaho
Comment options

Answer selected by davidroth
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
area-blazor Includes: Blazor, Razor Components
3 participants