Skip to content

Commit

Permalink
fix: autocomplete fetch options only if fetch defined
Browse files Browse the repository at this point in the history
  • Loading branch information
KovaCro committed Jan 2, 2024
1 parent d923b5d commit 67d28b4
Showing 1 changed file with 8 additions and 6 deletions.
14 changes: 8 additions & 6 deletions packages/lib/src/form-fields/autocomplete.wc.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -60,12 +60,14 @@
$: {
dispatch('value', value);
loading = true;
clearTimeout(lagTimeout);
lagTimeout = setTimeout(async () => {
options = await asyncOptions(value);
loading = false;
}, lag);
if(asyncOptions){
loading = true;
clearTimeout(lagTimeout);
lagTimeout = setTimeout(async () => {
options = await asyncOptions(value);
loading = false;
}, lag);
}
attachedInternals.checkValidity();
if (inputEl) {
Expand Down

0 comments on commit 67d28b4

Please sign in to comment.