Quantcast
Channel: Active questions tagged blazor - Stack Overflow
Viewing all articles
Browse latest Browse all 4839

Blazor not showing spinner when page loads

$
0
0

I have created a Blazor application that uses

Authentication Type = User Accounts

I have added a new menu item to the account area. This new area has a spinner that is shown until the data in that area is fetched from an API.

@if (loading){<div class="d-flex-center h-fill"><div class="spinner-container"><div id="spinner" class="spinner"></div></div></div>}else{...

loading is a bool that has a default value of true

private bool loading = true;

When debugging I can see that the code goes into here

protected override async Task OnInitializedAsync(){    await InitializeData();}

and into InitializeData()

however what I am not seeing is the spinner showing. I believe that OnInitializedAsync is stopping the spinner from even showing as when I am debugging (loading the page) I hit OnInitializedAsync and I can go through the function without seeing the spinner displayed.

I've tried using OnAfterRenderAsync however, although this does show the spinner, it never displays the data once it has been fetched. Even if I add StateHasChangedawait InvokeAsync(StateHasChanged); etc

Is there something I am missing here?

This razor file used to be a component which I loaded onto the page however to conform with the existing Blazor account area, I have added

@page "/Account/Manage/newarea to the top of the razor file


Viewing all articles
Browse latest Browse all 4839

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>