The MudTextField is bound to variable chatInput. Once user inputs their query and hits Enter, HandleKeyUp() is called. In that method, we grab the value of the query and then clear the field and attempt to update the state. The variable bound to the field changes to an empty value in debug, however the UI does not clear the text. We want the text clear, so the user can more easily type another query there.
Tech Stack: Blazor Server, MudBlazor, C#.
// Clear the input
chatInput = string.Empty;
// Trigger UI update to clear the input field
await InvokeAsync(StateHasChanged);
//Part of the MudBlazor element
MudTextField @bind-Value="chatInput" Placeholder="Type a message"
@bind-Value:after="@(() => InvokeAsync(StateHasChanged))"
@onkeyup="HandleKeyUp"