tom-select
tom-select copied to clipboard
[Bug]: Remove delay before displaying results
Bug description
When answering a question about tom-select performance in Stack Overflow, I noticed there is a delay when searching. When not loading the data from a remote resource, results start appearing half a second later, no matter how many options the element has.
Expected behavior
Ideally, results should display immediately after key press. In other solutions (Selectize.js, typeahead.js, etc.) results appear immediately
Steps to reproduce
- Go to https://tom-select.js.org/
- Click on the example
- Press "b"
- See results appear after a short delay, maybe 0.5 seconds
Additional context
- OS: All
- Browser: All
- Version: latest
- Device: All
I've also noticed this. I notice that selectize.js doesn't have this issue and there appears to be some minimal activity in that repo, even if it's mostly documentation related, so I decided to go with that one.
This is not documented, AFAICS, but this can be addressed setting refreshThrottle option to 0:
refreshThrottle: 0,
Found it in the code: https://github.com/orchidjs/tom-select/blob/69180fa9e79060060f1824fbde85537579d0005d/src/defaults.ts#L26
Nice find @pereorga! Can confirm it works in a codepen. One of us should make a PR to at least add this to the documentation, and maybe also default it to 0.
One of us should make a PR to at least add this to the documentation, and maybe also default it to 0.
I would be happy to do it if there was a chance it can get merged (unfortunately, the project seems a bit unmaintained at this moment). Meanwhile, people can find the solution here.
This is not documented, AFAICS, but this can be addressed setting
refreshThrottleoption to0:refreshThrottle: 0,Found it in the code:
https://github.com/orchidjs/tom-select/blob/69180fa9e79060060f1824fbde85537579d0005d/src/defaults.ts#L26
Good find!
For me I also had to change loadThrottle.
This issue has not been active in 120 days and has been marked "stale". Remove stale label or comment or this will be closed in 15 days