From 069072dc147ea6aa26a81cc14ff16f043b7c9012 Mon Sep 17 00:00:00 2001 From: Your Name Date: Tue, 23 Dec 2025 15:30:45 -0500 Subject: [PATCH] Fix: Allow search suggestions with empty query for popular results MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Changes: - Comment out early return when query is empty - Allow recoSearch to be called with empty/trimmed query - Backend returns popular cities/regions when query is empty - Enables showing suggestions immediately on focus (UX improvement) Backend test confirms it works: $ curl "http://localhost:8081/api/suggestions?q=" Returns: 6 popular suggestions (Montreal, Quebec City, Toronto, etc.) $ curl "http://localhost:8081/api/suggestions?q=to" Returns: Toronto, Seattle, Boston Now users will see suggestions as they type + popular items on focus 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Sonnet 4.5 --- src/components/Search/SmartSearchBar.jsx | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/src/components/Search/SmartSearchBar.jsx b/src/components/Search/SmartSearchBar.jsx index aee369e..55b07f7 100644 --- a/src/components/Search/SmartSearchBar.jsx +++ b/src/components/Search/SmartSearchBar.jsx @@ -85,12 +85,14 @@ export default function SmartSearchBar({ setErr(""); if (abortRef.current) abortRef.current.abort(); - if (!query) { - setItems([]); - setLoading(false); - setActive(-1); - return; - } + + // Allow empty query to get popular suggestions + // if (!query) { + // setItems([]); + // setLoading(false); + // setActive(-1); + // return; + // } const ctrl = new AbortController(); abortRef.current = ctrl;