Skip to content

Commit

Permalink
Merge pull request #192 from chosecz/master
Browse files Browse the repository at this point in the history
feat: Add prop fetchDebounceTime for fetch request
  • Loading branch information
mskocik authored Sep 11, 2023
2 parents 4f16d7e + f8ae9c4 commit 9b9ae3b
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,7 @@ fetch | string\|function | `null` | Check "remote datasource" se
fetchMode | string | `auto` | When set to `init` options are fetched only when mounted, when searching it search in downloaded dataset
fetchCallback | function | `null` | optional fetch callback
fetchResetOnBlur | bool | `true` | reset previous search results on empty input, related to `resetOnBlur`
fetchDebounceTime | number | `500` | Change default debounce time for fetch request
minQuery | number | `1` | Minimal amount of characters required to perform remote request. Usable with `fetch` property
lazyDropdown | bool | `true` | render dropdown after first focus, not by default
virtualList | bool | `false` | Whether use virtual list for dropdown items (useful for large datasets)
Expand Down
3 changes: 2 additions & 1 deletion src/lib/Svelecte.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,7 @@
export let fetchMode = 'auto';
export let fetchCallback = defaults.fetchCallback;
export let fetchResetOnBlur = true;
export let fetchDebounceTime = 500;
export let minQuery = defaults.minQuery;
// performance
export let lazyDropdown = defaults.lazyDropdown;
Expand Down Expand Up @@ -234,7 +235,7 @@
dispatch('fetch', options)
});
})
}, 500);
}, fetchDebounceTime);
if (initFetchOnly) {
if (typeof fetch === 'string' && fetch.indexOf('[parent]') !== -1 && !parentValue) return null;
Expand Down

0 comments on commit 9b9ae3b

Please sign in to comment.