I have run into an unexpected (and inexplicable) difference in UI binding behavior between Blazor WASM and Blazor server. Given the following razor component, the "Send" button is correctly disabled during the request, in both Blazor Server and Blazor WASM:
<MudButton Disabled="isProcessing" OnClick="Submit">Send</MudButton>
@code {
private bool isProcessing;
private async Task Submit()
{
isProcessing = true;
var contacts = await Mediator.Send(getContacts);
isProcessing = false;
}
}
After adding a second awaited call (IsValidAsync()) to the Submit-method, the button now stays enabled during the request in Blazor WASM, which I consider wrong. In Blazor Server it still gets disabled as expected:
private async Task Submit()
{
if (await validator.IsValidAsync())
{
isProcessing = true;
var contacts = await Mediator.Send(getContacts);
isProcessing = false;
}
}
Is there a clear reason as to why this kind of binding would not work in Blazor WASM? Or is this a clear bug in Blazor?