vueform / multiselect

Vue 3 multiselect component with single select, multiselect and tagging options (+Tailwind CSS support).
https://vueform.com
MIT License
808 stars 151 forks source link

DeBounce on search #385

Closed tomexsans closed 11 months ago

tomexsans commented 11 months ago

Hello,

Is there a way we can debounce the actions when typing, I noticed when using the Async Options from API, it requests per type or is there a simillar approach without using debouce?

https://jsfiddle.net/xajub20o/

Open up console and start typing on the example number 15.

image

tomexsans commented 11 months ago

NVM i used lodash

import {debounce} from "lodash";
<Multiselect
      v-model="tags"
      placeholder="Create or Search existing tags"
      mode="tags"
      :close-on-select="false"
      :searchable="true"
      :create-option="true"
      :object="true"
      :resolve-on-load="false"
      :delay="42"
      :limit="10"
      :min-chars="3"
      :options="debounce(async (query) => {
        return await fetchTags(query)
      }, 1000)"
      :on-create="handleTagCreate"
></Multiselect>

closing this as irrelevant

tomexsans commented 11 months ago

:delay also does the same functionality