@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.