diff --git a/components/policy-explorer/PolicySearchContainer.tsx b/components/policy-explorer/PolicySearchContainer.tsx index e6e18ad..ec828d4 100644 --- a/components/policy-explorer/PolicySearchContainer.tsx +++ b/components/policy-explorer/PolicySearchContainer.tsx @@ -32,6 +32,7 @@ export function PolicySearchContainer({ return; } + // Only search with 2 or more characters if (query.length < 2) { return; } diff --git a/components/search/SearchInput.tsx b/components/search/SearchInput.tsx index b80ac38..4ac85b3 100644 --- a/components/search/SearchInput.tsx +++ b/components/search/SearchInput.tsx @@ -2,7 +2,7 @@ import { Input } from '@/components/ui/input'; import { Search, Loader2 } from 'lucide-react'; -import { useState, useEffect } from 'react'; +import { useState, useEffect, useCallback } from 'react'; import { useDebounce } from 'use-debounce'; interface SearchInputProps { @@ -22,7 +22,8 @@ export function SearchInput({ onSearch, isSearching = false }: SearchInputProps) if (debouncedQuery.length >= 2 || debouncedQuery.length === 0) { onSearch(debouncedQuery); } - }, [debouncedQuery, onSearch]); + // eslint-disable-next-line react-hooks/exhaustive-deps + }, [debouncedQuery]); // Only depend on debouncedQuery, not onSearch return (