Skip to content

[Blazor p8] OnInitializedAsync is executed for twice on pre-render #13607

Closed
@ctrl-alt-d

Description

@ctrl-alt-d

Issue

OnInitializedAsync is executed for twice when page has been served as "pre-render".

Version

[dani@localhost tw]$ dotnet --version
3.0.100-preview8-013656

Steps to reproduce and screen shots:

@page "/"
@inject IUriHelper UriHelper

<h1>Hello, world!</h1>

Welcome to your new app.

@code{

    protected async override Task OnInitializedAsync()
    {
        System.Console.WriteLine("_*   ");
        System.Console.WriteLine("_**************************");
        System.Console.WriteLine("_***** Pre render ******");
        System.Console.WriteLine("_**************************");
        System.Console.WriteLine("_   ");
        return;
    }
}

And I see is executed for twice only on pre-render:

63875371-9fe68080-c9c3-11e9-9537-41924ef83401

Has it some explanation?

The question on stackoverfow: Blazor UriHelper.NavigateTo is calling the page twice

Metadata

Metadata

Assignees

No one assigned

    Labels

    ✔️ Resolution: By DesignResolved because the behavior in this issue is the intended design.area-blazorIncludes: Blazor, Razor Components

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions