Skip to content

Long delay when clearing the search term #222

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

Closed
rjnskl opened this issue Jun 25, 2024 · 1 comment
Closed

Long delay when clearing the search term #222

rjnskl opened this issue Jun 25, 2024 · 1 comment

Comments

@rjnskl
Copy link

rjnskl commented Jun 25, 2024

I'm loading a fairly long list of options (over 3000 entries) but the search and select functionality is working great. There appears to be an issue when a search string doesn't yield any results, or the user doesn't click on any, and then I try to clear the search string by either slowly deleting the characters or trying to select all and delete.

When deleting the very last search character or using select-all + delete, the component seems to hang for a very long time before resetting. It takes longer than the initial page load. Debug console doesn't appear to log anything helpful when this happens.

@rjnskl rjnskl changed the title Long delay when clearing the selection Long delay when clearing the search term Jun 25, 2024
@rjnskl
Copy link
Author

rjnskl commented Jun 28, 2024

Wrapping the following code snippet in if (keywordLen > 0) { ... } seems to fix it fwiw!

if (keywordLen > 0) { 

  let pos1 = 0
  do {
    pos1 = labelLowercaseNoAc.indexOf(keyword, pos1)
    if (pos1 >= 0) {
      let pos2 = pos1 + keywordLen
      positions.push([pos1, pos2])
      pos1 = pos2
    }
  } while (pos1 !== -1)

}

@rjnskl rjnskl closed this as completed Jun 28, 2024
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