I have this simple RadzenDropDown where the user can type a city-name and it will autocomplete what matches in the database.
<RadzenDropDown AllowFiltering="true"
@* Count="_totalMatches" *@
Data="@_cities"
FilterDelay="300"
LoadData="HandleLoadDataAsync"
Placeholder="@(Localizer["Type the name of the city ..."])"
TValue="City"
ValueChanged="HandleValueChangedAsync">
<Template>
@((context as City)?.FormattedCityName)
</Template>
</RadzenDropDown>
@code {
[Parameter]
public EventCallback<City> OnSelectedItemChange { get; set; }
IEnumerable<City> _cities;
private async Task HandleLoadDataAsync(LoadDataArgs loadData)
{
_cities = await DbContext.City.Where(...).OrderBy(...).Select(...).ToListAsync();
await InvokeAsync(StateHasChanged);
}
private async Task HandleValueChangedAsync(TblCity city)
{
await OnSelectedItemChange.InvokeAsync(city);
}
}
which all is working as expected. However, if I change to RadzenDropDownDataGrid and un-commenting (and setting) the Count-property I got a deadlock when HandleLoadDataAsync is invoked. I can see, that the SQL-is generated but it never goes further than the await ... ToListAsync() call.
First I thought this is an issue with the DbContext but I tried calling await DbContext...ToListAsync() in the OnInitializedAsync lifecycle-call which worked as expected. So I guess it has something to to with how the LoadData event-callback is invoked? Just guessing here as I wonder why it is working for RadzenDropDown but not for RadzenDropDownDataGrid.
Side note: Using the non-async calls will work but I still guess this is an issue/bug?
When running the page, open the Custom filtering example dropdown and input any filter text, the filtering will not apply and elements on the page will stop responding.
Any progress on this? I'm able to replicate it too.
I stumbled upon this when making an async call to db from LoadData.
Converting it to sync call works fine.
private void LoadData(LoadDataArgs args){
var list = db.Table.ToList();
}
Converting it to async call makes the initial call, but fails when filtering, it deadlocks on ToListAsync.
private async Task LoadData(LoadDataArgs args){
var list = await db.Table.ToListAsync();
}