Skip to content

feat(search): enhance search functionality with autocomplete suggestions#12

Merged
tijnjh merged 1 commit into
mainfrom
r
Jul 15, 2026
Merged

feat(search): enhance search functionality with autocomplete suggestions#12
tijnjh merged 1 commit into
mainfrom
r

Conversation

@tijnjh

@tijnjh tijnjh commented Jul 15, 2026

Copy link
Copy Markdown
Owner

No description provided.

Copilot AI review requested due to automatic review settings July 15, 2026 16:29
@tijnjh
tijnjh merged commit 7b9022d into main Jul 15, 2026
1 check passed

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR enhances the existing SearchBar component by adding autocomplete suggestions backed by a debounced, cancellable API call, improving search UX while the user types.

Changes:

  • Replaces the plain search input with @base-ui/react/autocomplete-based UI for rendering and selecting suggestions.
  • Adds a 250ms debounce layer and fetches suggestions via react-query, passing an AbortSignal for cancellation.
  • Updates getSearchSuggestions to accept an optional AbortSignal and forward it to $api.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.

File Description
src/lib/components/SearchBar.tsx Adds debounced suggestion fetching and renders an autocomplete dropdown with clear/search interactions.
src/lib/api/discovery.ts Extends getSearchSuggestions to accept an optional AbortSignal for request cancellation.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +24 to +28
const isWaiting = Boolean(query.trim()) && query.trim() !== debouncedQuery
const suggestions = isWaiting
? []
: suggestionsQuery.data?.collection ?? []

Comment on lines 39 to 42
onSubmit={(e) => {
e.preventDefault()
navigate({
to: '/search',
search: { q: query },
})
search(query)
}}
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

Successfully merging this pull request may close these issues.

2 participants