I noticed today after updating my project that my dropdowndatagrids were being populated on load, then cleared, and then repopulated. My page was fairly complex so I reduced it down to a simple page just to test, and the page loads, pulls in the terms data, then reloads. Is this a SingalIR issue? Here is my sample page:
@page "/order"
@rendermode InteractiveServer
@using Microsoft.AspNetCore.Authorization
@using Microsoft.AspNetCore.Components
@using Microsoft.AspNetCore.Components.Authorization
@using OrderPortal.Data
@using Radzen
@using Radzen.Blazor
@using OrderPortal.Services
@inject AuthenticationStateProvider AuthenticationStateProvider
@inject TermsService TermsService
@attribute [Authorize]
Test Order Page
@code {
private IEnumerable? Terms;
private int SelectedTerm;
private bool isInitialized = false;
protected override async Task OnInitializedAsync()
{
if (isInitialized) return;
isInitialized = true;
var authState = await AuthenticationStateProvider.GetAuthenticationStateAsync();
if (!authState.User.Identity.IsAuthenticated)
{
return;
}
Terms = await TermsService.LoadTermsAsync();
}
}