From a447641f1d3c4901f6972c10beeb48197901429e Mon Sep 17 00:00:00 2001 From: James Magahern Date: Fri, 13 Feb 2026 23:56:35 -0800 Subject: [PATCH] Search: loading state --- web/src/App.tsx | 23 +++++++++++++++++++---- 1 file changed, 19 insertions(+), 4 deletions(-) diff --git a/web/src/App.tsx b/web/src/App.tsx index 44755b5..d534d1b 100644 --- a/web/src/App.tsx +++ b/web/src/App.tsx @@ -306,6 +306,7 @@ export default function App() { }, [selectedChat, selectedChatSummary, selectedItem, selectedSearch, selectedSearchSummary]); const isSearchMode = selectedItem?.kind === "search"; + const isSearchRunning = isSending && selectedItem?.kind === "search"; const handleCreateChat = async () => { setError(null); @@ -444,13 +445,27 @@ export default function App() { throw new Error("Unable to initialize search"); } + const nowIso = new Date().toISOString(); setSelectedSearch((current) => { - if (!current || current.id !== searchId) return current; + if (!current || current.id !== searchId) { + return { + id: searchId, + title: query.slice(0, 80), + query, + createdAt: nowIso, + updatedAt: nowIso, + requestId: null, + latencyMs: null, + error: null, + results: [], + }; + } return { ...current, title: query.slice(0, 80), query, error: null, + latencyMs: null, results: [], }; }); @@ -725,8 +740,8 @@ export default function App() { ) : null} - {isLoadingSelection && !selectedSearch?.results.length ? ( -

Loading search...

+ {(isLoadingSelection || isSearchRunning) && !selectedSearch?.results.length ? ( +

{isSearchRunning ? "Searching Exa..." : "Loading search..."}

) : null} {!isLoadingSelection && !selectedSearch?.query ? ( @@ -737,7 +752,7 @@ export default function App() { ) : null} - {!isLoadingSelection && !!selectedSearch?.query && selectedSearch.results.length === 0 ? ( + {!isLoadingSelection && !isSearchRunning && !!selectedSearch?.query && selectedSearch.results.length === 0 ? (

No results found.

) : null}