Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Blazor Preview8 #13172

Closed
MarkTMcp opened this issue Aug 15, 2019 · 1 comment
Closed

Blazor Preview8 #13172

MarkTMcp opened this issue Aug 15, 2019 · 1 comment
Labels
area-blazor Includes: Blazor, Razor Components question

Comments

@MarkTMcp
Copy link

Old way of mapping (prior to Preview8): endpoints.MapBlazorHub();
New way on generated sample Server Side App (since Preview8): endpoints.MapBlazorHub(selector: "app");

New way creates the index page via MainLayout.razor twice.
You can confirm by placing breakpoint on OnInitialized() in MainLayout file.

The app appears to work normally, but all code on the default page is executed twice. This includes DI objects used by the default page (such as DBContexts)

@Eilon Eilon added the area-blazor Includes: Blazor, Razor Components label Aug 15, 2019
@mkArtakMSFT
Copy link
Member

Thanks for contacting us, @MarkTMcp.
The behavior you're observing is by-design. You can disable pre-rendering and the OnInitialized will be called once only.

@ghost ghost locked as resolved and limited conversation to collaborators Dec 2, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
area-blazor Includes: Blazor, Razor Components question
Projects
None yet
Development

No branches or pull requests

3 participants