-
Notifications
You must be signed in to change notification settings - Fork 10.1k
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
In Blazor component (razor page) OnInitializedAsync method fires twice. #13448
Comments
This is likely due to pre-rendering. If you think that's not the case, feel free to reopen and we'd be happy to investigate. |
OnInitializedAsync execution happening twice (the entire process will execute again) and this issue were not happening on projects those created in the earlier preview version. |
I can confirm, component OnInitializedAsync is called twice on page load. |
How to reopen this issue? |
OnInitializedAsync execution happening twice (the entire process will execute again) and this issue were not happening on projects those created in the earlier preview version. |
Is there any way to prevent methods multiple executions on OnInitializedAsync |
@ajai1109 \ @brzezinol the default server-side template has pre-rendering enabled. This would result in multiple calls to // _Host.cshtml
<app>
- @(await Html.RenderComponentAsync<App>(RenderMode.ServerPrerendered))
+ @(await Html.RenderComponentAsync<App>(RenderMode.Server))
</app> If that's not what's causing the call to appear twice, please share a sample app. |
Ok, in other hands, how to use pre-rendering properly? `
How to handle code above with pre-rendering. I cannot disable prerendering RenderMode.Server is not known... |
What namespace does RenderMode.Server exist in? |
What a silly idea to call the main entry point of a page twice? |
i confirm this issue happens in client project i use latest preview 9 version there's no |
@pranavkm Can you please reopen? |
If we NavigateTo Blazor component (razor page) OnInitializedAsync method fires twice. But in another Blazor project, it is not executing twice!
The text was updated successfully, but these errors were encountered: