Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Setting minLength=1 With debounceWaitMs > 0 Causes an Unnecessary Fetch #29

Closed
adonig opened this issue Jun 10, 2019 · 1 comment
Closed

Comments

@adonig
Copy link

adonig commented Jun 10, 2019

If you set minLength to 1 instead of 2 (the default), there is an unnecessary fetch for the first character of the search term. The first fetch should be fired after debounceWaitMs milliseconds, but there is an immediate fetch for the first character.

The issue probably has to be somewhere between line 392 and line 404:

https://github.com/kraaden/autocomplete/blob/master/autocomplete.ts#L392

Strangely that first fetch doesn't happen with minLength=2. I'm not sure why, but probably you know that code better than I do :)

@adonig
Copy link
Author

adonig commented Jun 10, 2019

Actually it's not a bug. Setting the debounceWaitMs to a higher value (500 instead of 200) solves the problem.

@adonig adonig closed this as completed Jun 10, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant