pstanoev / simple-svelte-autocomplete

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

fix field not being clear when item change from outside the component #190

Closed Hugome closed 1 year ago

Hugome commented 1 year ago

When onSelectedItemChanged is called after a reactivity change from outside the component and the new selectedItem is undefined/null, the text keep the same previous value, but change the actual value.

The labelFunction/safeLabelFunction check if the selectedItem is undefined/null and set the correct empty string in the text

Blitzlord commented 1 year ago

Hey, I noticed the same issue. When trying to change/clear the input from the outside (like in this example) by using undefined , the input text remains.