Blazored / Typeahead

Typeahead control for Blazor applications
https://blazored.github.io/Typeahead/
MIT License
439 stars 103 forks source link

[Bug] ArgumentNullException after pressing 'backspace' key #300

Open oruchreis opened 1 year ago

oruchreis commented 1 year ago

Describe the bug If we type a few letter less than MinimumLength and IsMultiselect is true, we get ArgumentNullException after clearing text by pressing backspace key. This error occurs when the MinimumLength property is set and the search metod is not triggered because of count of letters is not reached MinimumLength yet, and backspace key is used for clearing.

      System.ArgumentNullException: Value cannot be null. (Parameter 'source')
         at System.Linq.ThrowHelper.ThrowArgumentNullException(ExceptionArgument argument)
         at System.Linq.Enumerable.Any[TSource](IEnumerable`1 source)
         at Blazored.Typeahead.BlazoredTypeahead`2.HandleKeyup(KeyboardEventArgs args)
         at Microsoft.AspNetCore.Components.ComponentBase.CallStateHasChangedOnAsyncCompletion(Task task)
         at Microsoft.AspNetCore.Components.RenderTree.Renderer.GetErrorHandledTask(Task taskToHandle, ComponentState owningComponentState)

To Reproduce

Hosting Model (is this issue happening with a certain hosting model?):

Version: 4.7.0