@Codewrinkles

A short clarification. According MS documentation, there is a way for stateful reconnects that could potentially also be applied to this scenarios. And this would be to use some kind of memory stream to keep track of the loaded data and when the render process goes the second time through OnInitialized you can get the data from the stream directly. However, I don't think that a simple task in all modern SPA frameworks (like initializing data) should required this level of complexity in our applications.

@dhanarajdavid7070

Thank you for the valuable information. I have spent many hours to resolve this problem

@lacuevadelinsecto

What about PersistentComponentState? I think is more SEO friendly. You can use the PersistentComponentState implementation, so you can set prerendering to true, but getting to call Database/intensive operations once.  Calling the OnInitialized method is not really a problem, the problem comes when data is requested twice from DB.

@StateHasChanged

I love Blazor 8, but MS needs to do a better job of dog fooding their stuff. When I ported my Blazor Server app to the Blazor Web template, I had this same issue. Took me a good hour of internet research to find this same workaround. For my app, I set this globally on the routes component, as it is a SPA.

@AmerBakeer

Wonderful  !! Thank you for the valuable information. It will help me solve many problems.

@RichardNguyen-y7l

I agree, it's the worst when calling LoadData from DB and the function got recalled again.

@majormartintibor

Very helpful video, thanks!

@grimmersnee

Nice. I'm sure I will use this soon. You have also lost a l ot of weight, whatever u are doing is working. Great job man

@androidsavior

the biggest two issues of blazor wasm are :
- startup time (caching enabled - empty App.razor - empty Program.cs)  1.5s to render an empty page.
- hot reloading issues during development is a nightmare
I've tried everything that I could to optimize the startup time for a completely empty blazor wasm app, 1.5s is what i get. So with a real application the wait time can be +4 or +5 seconds which is not acceptable at all :(

@carolinacordero6616

On a fresh new application based on the default Blazor Web App Template, I never see the "Loading..." message at 1:28, and at Network tab, the request shows as: Status (pending), not immediately 200  as in your demo.  Can anyone help me?

@DeepWorksStudios

What about presistingcomponent state that’s a functionality from the framework

@AthelstanEngland

As an aside you mention at 02:11 that we can remove @attribute [StreamRendering] because you have put in @rendermode InteractiveServer but don't they do different things?  StreamRendering displays the "Loading..." whilst waiting for the server to complete the OnInitialized logic. Interactive simply allows the page to respond to events. Maybe it was just your phrasing but it sounded as if you can't use both together?

@luciannaie

nice workaround. I'm sure I'll use it

@geraldmaale

For whatever reason, I couldn't reproduce this behaviour using the Blazor Web App with server interactivity location set to Per page/component. The breakpoint set on the OnInitializedAsync method was not hit twice but once. 

Did you miss something or I missed something?

@liammcmullen4497

thanks for  a big heads-up

@Duelweb

Super stuff, thanks!

@abhayprince

For this issue,I have discussed the PersistComponentState approach in detail https://youtu.be/qQ91rdMgIMM

@AmerBakeer

Unfortunately, I think disabling/bypassing Pre-rendering harms SEO and prevents search engines from seeing/indexing page content, even though the solution is useful from a UX point of view.
I eventually had to re-enable it because search engines saw pages as empty.
Are you aware of a better solution that still allows prerendering to remain enabled?

@justanotherbigdude

You can actually move the data load and delay into onafterrender instead oninit, first render only of course

@shabanelmogy7912

how can i sync between sqlite on mobile offline and remote database (restapi with sql server ) ?