pstanoev / simple-svelte-autocomplete

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

skip client side input text filtering when request are done serverside #127

Closed azmeuk closed 2 years ago

azmeuk commented 2 years ago

I encountered a usecase where filtering was done serverside, and a user input contained a dot ., but the server response seemed incoherent. I saw that the dot was deleted by prepareUserEnteredText.

If filtering is done serverside (i.e. there is a searchFunction) then the input cleaning (i.e. prepareUserEnteredText) should also be done serverside.

With this patch, prepareUserEnteredText is not called if searchFunction is defined.

If you want, I can make this behavior optional.

pstanoev commented 2 years ago

Added new option: cleanUserText=false which expicity controlls if prepareUserEnteredText is called.

Available in the new version 2.3.0.