Button is not reacting to IsBusy or reacting too late

Hi there everyone, I am having issues with some of the component animations
I'm using the following code to use my button:

<RadzenButton style="width: 160px" IsBusy=@busy Click=@SynthDefault Text="Save" />
bool busy = false;
    async Task SynthDefault()
    {
        busy = true;
        StateHasChanged();
        TfLogic.Init();
        await JsRuntime.InvokeVoidAsync("alert", "The Terraform files have been generated");
        await JsRuntime.InvokeVoidAsync("alert", "clean the cdktf.out dir");
        FileCleanup.CleanUpOutFolder();
        busy = false;
    }

The button never changes states and just keeps displaying the default text, which is "Save".
Might anyone know what I'm doing wrong?

Hi @HamburgerPlsdotexe,

This is a well known issue with Blazor. You can try adding await Task.Yield() so the UI has a chance to update.

1 Like

This did the trick! Thank you!