-
-
Notifications
You must be signed in to change notification settings - Fork 186
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
change the score function to prevent drag #325
Conversation
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
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.
Hey @steveoni! FYI typing anything in the search input causes the site to crash.
@timc1 i will test it now. i just copied the code I updated from work and edit directly on github and push. i will update you once I fix that. FYI that's what we are using here https://www.datopian.com/ |
@timc1 is actually a small fix. now working without crashing the page |
src/useMatches.tsx
Outdated
includeScore: true, | ||
includeMatches: true, | ||
threshold: 0.2, | ||
minMatchCharLength: 2, |
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.
Let's just keep this at 1 – it's kinda weird to type a single character and see the results disappear until we type once more.
package.json
Outdated
@@ -60,6 +60,7 @@ | |||
"@radix-ui/react-portal": "^1.0.1", | |||
"command-score": "^0.1.2", |
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.
Drop this and rerun npm install
?
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.
@timc1 done
Thank you both for following up on this issue. I was debugging this myself. I'm adding a profiler screenshot proving that ✅ It seems that @timc1 Will this fix hit |
Hey @rareyesdev! I'll get this update merged in soon; want to look at the configs a little more prior. You will just need to install the latest version once I get it released :) |
return str.split(/[\s\-,.!()]+/).filter(Boolean); | ||
}, | ||
}; | ||
const fuse = new Fuse(filtered, fuseOptions); |
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.
Don't you want to move this inside the useMemo
and only create a new fuse instance when filtered
changes? It's essentially rebuilding the search index on every render
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.
Yah #329
this pr is a propose solution to fix the drag/slow issue base on this #279 #252