Skip to content

Commit

Permalink
fix(ui): fix the repository search pattern (#2797)
Browse files Browse the repository at this point in the history
  • Loading branch information
liangfung authored Aug 7, 2024
1 parent b4bb077 commit e25c43b
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions ee/tabby-ui/app/files/components/code-search-bar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -56,8 +56,10 @@ export const CodeSearchBar: React.FC<CodeSearchBarProps> = ({ className }) => {
const repoId = activeRepo?.id

const repositorySearchPattern = React.useMemo(() => {
const prefixRegex = /-?[f|lang]:(\S+)/g
return trim(debouncedQuery).replace(prefixRegex, '')
if (!debouncedQuery) return undefined

const prefixRegex = /-?(f|lang):\S+\s?/g
return trim(debouncedQuery.replace(prefixRegex, ''))
}, [debouncedQuery])

const [{ data: repositorySearchData }] = useQuery({
Expand Down

0 comments on commit e25c43b

Please sign in to comment.