Skip to content

Commit c237913

Browse files
committed
fix(SearchPanel): show empty state only after search submitted
- Added hasSearched state to track if user performed search - Empty state now only shows after actual search returns 0 results - Prevents confusing 'No results' message before user searches
1 parent bc28727 commit c237913

2 files changed

Lines changed: 4 additions & 1 deletion

File tree

docker-compose.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ services:
2727
environment:
2828
- REDIS_HOST=redis
2929
- REDIS_PORT=6379
30+
- ALLOWED_ORIGINS=http://localhost:3000,http://localhost:5173,http://localhost:5174
3031
- OPENAI_API_KEY=${OPENAI_API_KEY}
3132
- PINECONE_API_KEY=${PINECONE_API_KEY}
3233
- PINECONE_INDEX_NAME=${PINECONE_INDEX_NAME}

frontend/src/components/SearchPanel.tsx

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,11 +17,13 @@ export function SearchPanel({ repoId, apiUrl, apiKey }: SearchPanelProps) {
1717
const [loading, setLoading] = useState(false);
1818
const [searchTime, setSearchTime] = useState<number | null>(null);
1919
const [cached, setCached] = useState(false);
20+
const [hasSearched, setHasSearched] = useState(false);
2021

2122
const handleSearch = async () => {
2223
if (!query.trim()) return;
2324

2425
setLoading(true);
26+
setHasSearched(true);
2527
const startTime = Date.now();
2628

2729
try {
@@ -165,7 +167,7 @@ export function SearchPanel({ repoId, apiUrl, apiKey }: SearchPanelProps) {
165167
</div>
166168

167169
{/* Empty State */}
168-
{results.length === 0 && query && !loading && (
170+
{results.length === 0 && hasSearched && !loading && (
169171
<div className="card p-16 text-center">
170172
<div className="w-20 h-20 mx-auto mb-4 rounded-2xl glass flex items-center justify-center">
171173
<span className="text-4xl">🔍</span>

0 commit comments

Comments
 (0)