Variables are not updated in components after by changed in a onclick event async change in code

Hi

I have the following Radzen Progress Bar in my page:

<RadzenPanel>
    <RadzenProgressBar Value="100" ShowValue="false"
                       Mode="ProgressBarMode.Indeterminate" Visible="@IsActiveSlide"
                       @rendermode="@RenderMode.InteractiveServer" />
</RadzenPanel>

the variable IsActiveSlide is changed inside a on click event but the new value is not reflected in the progress bar and continue invisible.

The abbreviate code of the onclick is the following:


  private async Task OnClickRunAsync(string text)
  {
      try
      {
          // Abreviated her comes a await for call a function in the backend.  
          IsActiveSlide = true;
          await InvokeAsync(() => StateHasChanged());
    }
  // program continue

The event is call as following:

 <RadzenButton Click=@(() => OnClickRunAsync("Execute Console App"))
               Text=" Run DeadHead Booking Agent Now" Icon="Sprint"
               ButtonStyle="Radzen.ButtonStyle.Primary"
               @rendermode="@RenderMode.InteractiveServer">
 </RadzenButton>

I tried using:
StateHasChanged();
without success.

The program is Blazor, NET 8.0 Blazor Server.

Some one has any idea?

This sounds as interactivity related problem. Try setting rendermode for the entire page. Also see if the code from the event handler is executed via debugging.

Thanks for your answer,
Yes the method is executed. I found the solution in other response : c# - Display wait or spinner on API call - Stack Overflow
it is needed to insert a Task.Delay after StatedHasChange(); as is show below:

IsVisibleSlide = true;
IsDisableButton = true;
StateHasChanged();
await Task.Delay(1);

Thanks