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:
Laravel Cheat Sheet for Eloquent ORMORM (Object Relational Mapping) is used to facilitate database CRUD operations. Laravel comes with Eloquent ORM. This tutorial was created to provide … Read More
Multipal File Upload In laravel with DatabaseMultipal File Upload In laravel with Database How To Upload Multiple Files in LaravelHandling Multiple File Upload in LaravelLaravel Multiple Files Up… Read More
How to Upload Multiple Images Files in Laravel with Validation ? How To Upload Multiple Files in LaravelHandling Multiple File Upload in LaravelLaravel Multiple Files Upload Tutorial Example From Scratch1. Cre… Read More
How to download image or pdf with html on click button How to download image or pdf with html on click button … Read More
Facebook Login with Socialite in Laravel 8 Install Laravel 5.8First, let install Laravel 5.8 using the following command (Make sure you have installed composer in your PC). Click on … Read More
0 comments:
Post a Comment
Thanks