This is my razor component page:
@page "/SignIn"
@inject INotificationService _localStorage
@inject NavigationManager _navigationManager
@inject IAuthenticationService _authService
@rendermode @(new InteractiveWebAssemblyRenderMode(prerender: false))
...
@code {
public bool PageLoading { get; set; }
private Models.Notification? Notification { get; set; } = null;
public SignInRequestDto SignInRequest { get; set; } = new();
public bool IsAuthFailed { get; set; }
public string ReturnURL { get; set; }
public string Error { get; set; }
protected override async Task OnInitializedAsync()
{
PageLoading = true;
StateHasChanged();
System.Threading.Thread.Sleep(3000);
await GetNotification();
PageLoading = false;
}
...
So when I am on the Home page and I click "Se connecter" (that means sign in), the page does not goes to the signIn page, but instead stall on the Home page executing the OnInitializeAsync of the SignIn and then when it is finish, it shows finally the SingIn page.
I was expected that prerender: false will fix this but it does nothing.
This is the MainLayout that will redirect to the /SignIn page.
@using Microsoft.AspNetCore.Components.WebAssembly.Authentication
@inject NavigationManager Navigation
Hello, @context.User.Identity?.Name!
Se déconnecter
Se connecter
@code{
public void BeginLogOut()
{
Navigation.NavigateToLogout(Routes.Disconnect);
}
}
This is the demo:
https://drive.google.com/file/d/15fd0P8a4cuyH1F6rg8B6CN7MBfeSVk16/view?usp=sharing
/>
I expect that I will see the Loading component and the right page (/signin) instead of waiting on page Home before OnInitializeAsync is finished.
Render mode does not work properly on blazor web assembly .NET 8
Programing Coderfunda
February 29, 2024
No comments
Related Posts:
Automatically Restart Horizon When Local PHP Files Change How many hours have lost debugging local jobs only to find out that you forgot to restart Horizon?Laravel Horizon Watcher package contains an Ar… Read More
Rector Rules for Laravel for Refactors the Code of Your App Rector instantly upgrades and refactors the PHP code of your application. This package is a Rector extension developed by the Laravel commu… Read More
Google Cloud Tasks to be used as the Queue Driver in Laravel Laravel Google Cloud Tasks Queue package allows Google Cloud Tasks to be used as the queue driver. This package requires Laravel 6 or highe… Read More
A Set of Amazing Laravel Validation Rules for Credit Card This is a Set of Amazing Laravel Validation Rules for Credit Cards that will validate that a given credit card number, expiration date, or CVC i… Read More
Automatically Maintain Model Columns with Laravel Userstamps Laravel Userstamps provides an Eloquent trait that automatically maintains created_by and updated_by columns on your mo… Read More
0 comments:
Post a Comment
Thanks