-
-
Notifications
You must be signed in to change notification settings - Fork 232
fix: only search on enter keypress #1226
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
base: main
Are you sure you want to change the base?
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
2 Skipped Deployments
|
e7f832a to
b283763
Compare
Codecov Report❌ Patch coverage is
📢 Thoughts on this report? Let us know! |
|
Note Reviews pausedIt looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the Use the following commands to manage reviews:
Use the checkboxes below for quick actions:
📝 WalkthroughWalkthroughDebounce-based URL synchronisation and the debounce import were removed. In app/components/Header/SearchBox.vue, URL updates and the input watcher now act only when the current route is named "search"; URL-to-input sync updates Possibly related PRs
Suggested reviewers
🚥 Pre-merge checks | ✅ 1✅ Passed checks (1 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing touches🧪 Generate unit tests (beta)
Comment |
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.
Actionable comments posted: 1
|
I need to fix the tests now |
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.
Actionable comments posted: 1
🧹 Nitpick comments (1)
app/components/Header/SearchBox.vue (1)
47-49: Consider adding a type guard forroute.name.
route.namecan bestring | symbol | null | undefined, whilstpagesWithLocalFilteris aSet<string>. AlthoughSet.has()handles mismatched types gracefully at runtime (returningfalse), an explicit type check would satisfy strict type safety. The same pattern appears on line 59.♻️ Proposed type-safe guard
- if (pagesWithLocalFilter.has(route.name)) { + if (typeof route.name === 'string' && pagesWithLocalFilter.has(route.name)) {Apply the same pattern at line 59.
As per coding guidelines: "Ensure you write strictly type-safe code".
|
I think this is a duplicate of #1107 unfortunately |
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.
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
app/pages/index.vue (1)
18-29:⚠️ Potential issue | 🟡 MinorRemove unused debounce handlers.
The
handleInputNpm,handleInputAlgolia, andhandleInputfunctions defined on lines 18–29 are never called — there is no@inputbinding on theInputBasecomponent. Since the PR's intent is to search only on Enter keypress (via form submit on line 74), these functions and thedebouncedependency are redundant and should be removed.🧹 Proposed fix to remove dead code
-const handleInputNpm = debounce(search, 250, { leading: true, trailing: true }) -const handleInputAlgolia = debounce(search, 80, { leading: true, trailing: true }) - -function handleInput() { - if (isTouchDevice()) { - search() - } else if (isAlgolia.value) { - handleInputAlgolia() - } else { - handleInputNpm() - } -}
Searches on enter key press