tom-select icon indicating copy to clipboard operation
tom-select copied to clipboard

[Bug]: Remove delay before displaying results

Open pereorga opened this issue 1 year ago • 5 comments

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

  1. Go to https://tom-select.js.org/
  2. Click on the example
  3. Press "b"
  4. See results appear after a short delay, maybe 0.5 seconds

Additional context

  • OS: All
  • Browser: All
  • Version: latest
  • Device: All

pereorga avatar Jun 18 '24 16:06 pereorga

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.

nbelakovski-mssm avatar Jul 07 '24 03:07 nbelakovski-mssm

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

pereorga avatar Jul 07 '24 07:07 pereorga

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.

nbelakovski-mssm avatar Jul 07 '24 14:07 nbelakovski-mssm

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.

pereorga avatar Jul 07 '24 18:07 pereorga

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

Good find! For me I also had to change loadThrottle.

kristofer84 avatar Oct 15 '24 12:10 kristofer84

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

github-actions[bot] avatar Feb 13 '25 02:02 github-actions[bot]