dotnet / aspnetcore

ASP.NET Core is a cross-platform .NET framework for building modern cloud-based web applications on Windows, Mac, or Linux.

Home Page:https://asp.net

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Blazor, during the first visit, the page loads twice

Alerinos opened this issue · comments

Is there an existing issue for this?

  • I have searched the existing issues

Describe the bug

The problem occurs on the Blazor Server Side. If we enter the website, it loads statically for the first time, everything is fine. Then the next loading is dynamic.
Video: (Test network Fast 3G)
https://www.awesomescreenshot.com/video/9628814?key=df3856b7747e341d4c44c561c7887af2
https://gyazo.com/42990466ec4368bb980f71a65c40c981

During the first charge
image

Then the sida server immediately loads
image

I noticed that in this case there are even 3 page loads ...

This problem occurs everywhere, even in the clean design created by vs.

URL page:
https://instytutkrypto.pl/

What could it be? How to prevent this from happening? I once saw a tutorial on this but only for wasm.

Expected Behavior

The page should load once, not jump.

Steps To Reproduce

No response

Exceptions (if any)

No response

.NET Version

.net core 7 preview 5

Anything else?

No response

Once during prerendering, once after. This is by design.

Relevant docs.

@Alerinos thanks for contacting us.

This is currently by design. There is an issue to change how this work that can be found here #15317

I would suggest you upvote that issue instead.

@yugabe

image
If I set the method not asynchronous, my code will not execute.

@javiercn
I gave a thumbs up. In my opinion, the .net 7 version should be catching up, not creating minimal interfaces and things that are not must-have.

Do you have any idea / method to fix this problem quickly? Unfortunately, I can't call a non-async method.