Quantcast
Channel: Active questions tagged blazor - Stack Overflow
Viewing all articles
Browse latest Browse all 4839

Blazor with .NET 10 mode: @rendermode @(new InteractiveWebAssemblyRenderMode(prerender: false))

$
0
0

I am updating a Blazor web assembly project from .NET 9 to .NET 10, and noticed a change in behavior with the following line of code:

@rendermode @(new InteractiveWebAssemblyRenderMode(prerender: false))

In .NET 9, when using this mode without prerendering, lifecycle methods such as OnInitialized and OnInitializedAsync were executed normally on the client.

In .NET 10, however, these lifecycle methods are no longer triggered.

Does anyone know how to make them launch the same way as in the previous frameworks?

@page "/"@using System.Security.Claims@using shared_library.Layout@using webapp_blazor.Client.Servicios;@layout LayoutRaiz@rendermode @(new InteractiveWebAssemblyRenderMode(prerender: false))@inject Servicio_AuthenticationStateProvider_Wasm _Servicio_AuthenticationStateProvider@inject NavigationManager _NavigationManager@code {    protected async override Task OnInitializedAsync()    {        var authenticationState = await _Servicio_AuthenticationStateProvider.GetAuthenticationStateAsync();        ClaimsPrincipal _ClaimsPrincipal = authenticationState.User;        /*Otra forma de comprobar si esta validado*/        if (!authenticationState.User.Identity.IsAuthenticated)        {            _NavigationManager.NavigateTo("/Autenticar_wasm");        }        else        {            _NavigationManager.NavigateTo("/Inicio_wasm");        }    }    protected async override void OnAfterRender(bool firstRender)    {        var authenticationState = await _Servicio_AuthenticationStateProvider.GetAuthenticationStateAsync();        ClaimsPrincipal _ClaimsPrincipal = authenticationState.User;        /*Otra forma de comprobar si esta validado*/        if (!authenticationState.User.Identity.IsAuthenticated)        {            _NavigationManager.NavigateTo("/Autenticar_wasm");        }        else        {            _NavigationManager.NavigateTo("/Inicio_wasm");        }    }}

Viewing all articles
Browse latest Browse all 4839

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>