-
Notifications
You must be signed in to change notification settings - Fork 13.1k
CommandPalette: Use fuzzySearch util from grafana/data #108884
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
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I assume this should not actually change any behaviour right?
|
Are there any existing tests that cover the expected behaviour of the old hook? |
|
This restores the behavior we had earlier until the bug in kbar library was discovered: #61278. |
|
it looks like they swapped out for hopefully they have the correct fuse.js settings that don't return nonsense results, too. https://github.com/leeoniya/uFuzzy?tab=readme-ov-file#search-quality |
|
btw, if you're looking to simplify, we now have a fuzzySearch function that implements all the necessary conditions: https://github.com/grafana/grafana/blob/main/packages/grafana-data/src/utils/fuzzySearch.ts |
Yeah, that was my original commit, but then I saw a TODO in |
|
the reason i wrote uFuzzy was because of my frustration with Fuse (both startup/indexing time and mem/cpu perf and result quality). ufuzzy also has typo tolerance, which i dont think fuse supports. maybe you can see why i'm not thrilled about the change 😅. your call, tho. i'd suggest at least testing it with 10k-20k items and compare results/ordering. /0.02 |
ea82004 to
07e37f5
Compare
I did some quick tests and it seems like the fuzzySearch function is way faster, so let's use that. |
* CommandPalette: Use fuzzySearch util from grafana/data * Comment
* CommandPalette: Use fuzzySearch util from grafana/data * Comment
What is this feature?
Seeing as timc1/kbar#255 has been fixed (and we're using the kbar version with the fix), we can switch back to using
useMatcheshook from kbar.