afcapel / stimulus-autocomplete

Stimulus autocomplete component
MIT License
478 stars 61 forks source link

Respect min-length-value option #138

Closed Simonpedro closed 1 year ago

Simonpedro commented 1 year ago

When the min length value is set to 0, the autocomplete will not fetch the data from the server. This is a problem when a consumer wants to also show something when the input is empty.

For example, it would unblock the following use case:

<input
  name="search"
  data-autocomplete-target="input"
  data-autocomplete-url-value="/search?q={q}"
  data-autocomplete-min-length-value="0"
  data-action="click->autocomplete#onInputChange"
/>

in which some results are shown as soon as the input is focused.

It's a simple way to address the "fetch on focus" issue and an alternative to "fetch on focus" PR.

netlify[bot] commented 1 year ago

Deploy Preview for stimulus-autocomplete canceled.

Name Link
Latest commit 9628feb5b01dc58e89dfbe4acff2e499805e5c22
Latest deploy log https://app.netlify.com/sites/stimulus-autocomplete/deploys/649b93663a1b200007f719f7
Simonpedro commented 1 year ago

Seems it didn't gain traction.

arrowcircle commented 10 months ago

Any updates on merging this?