Blazor navigation without reload

At the moment the NavMenu has no mechanism of recognising authentication state changes - the logged in Identity has changed.

You can do this by injecting the AuthenticationStateProvider and then hooking up an event handler (that calls StateHasChanged) to the AuthenticationStateProvider's AuthenticationStateChanged event.

This should work.

@implements IDisposable

..... Razor

    [Inject] private AuthenticationStateProvider? AuthState { get; set; }

    protected async override Task OnInitializedAsync()
    {
        // other code you may have
        AuthState.AuthenticationStateChanged += this.OnAuthStateChanged;
    }

    private async void OnAuthStateChanged(Task<AuthenticationState> state)
        => await InvokeAsync(StateHasChanged);

    public void Dispose()
        => AuthState.AuthenticationStateChanged -= this.OnAuthStateChanged;