pstanoev / simple-svelte-autocomplete

Simple Autocomplete / typeahead component for Svelte
http://simple-svelte-autocomplete.surge.sh/
MIT License
464 stars 78 forks source link

Whitespace sometimes causes infinite loop #159

Closed Shkoklev closed 2 years ago

Shkoklev commented 2 years ago

When the option cleanUserText is set to false and the search function returns at least one item in the dropdown, if we try to append a whitespace character to the search term, an infinite loop is triggered and the component freezes Screenshot 2022-04-14 at 10 21 51

The infinite loop is triggered in the highlightFilter function because the 'keywords' parameter contains an empty string as an element of the array.

azmeuk commented 2 years ago

Fixed by #160