From 5cefb88bb2e4cb940b9c1868baafd01f7c253a89 Mon Sep 17 00:00:00 2001 From: John Philip Date: Mon, 23 Feb 2026 16:30:33 -0500 Subject: [PATCH] perform search on first navigate Signed-off-by: John Philip --- plugins/search-react/src/context/SearchContext.tsx | 3 +-- plugins/search/src/components/SearchPage/SearchPage.tsx | 4 +--- 2 files changed, 2 insertions(+), 5 deletions(-) diff --git a/plugins/search-react/src/context/SearchContext.tsx b/plugins/search-react/src/context/SearchContext.tsx index dc129c6327..0d18b888e5 100644 --- a/plugins/search-react/src/context/SearchContext.tsx +++ b/plugins/search-react/src/context/SearchContext.tsx @@ -138,14 +138,13 @@ const useSearchContextValue = ( const result = useAsync(async (): Promise => { if (isFirstEmptyMount.current) { + isFirstEmptyMount.current = false; if (!term && !types.length && !Object.keys(filters).length) { return { results: [], numberOfResults: 0, }; } - - isFirstEmptyMount.current = false; } // Here we cancel the previous request before making a new one diff --git a/plugins/search/src/components/SearchPage/SearchPage.tsx b/plugins/search/src/components/SearchPage/SearchPage.tsx index 8428fb6bb5..92b327207f 100644 --- a/plugins/search/src/components/SearchPage/SearchPage.tsx +++ b/plugins/search/src/components/SearchPage/SearchPage.tsx @@ -59,9 +59,7 @@ export const UrlUpdater = () => { setPageCursor(query.pageCursor as string); } - if (query.types) { - setTypes(query.types as string[]); - } + setTypes(query.types ? (query.types as string[]) : []); }, [prevQueryParams, location, setTerm, setTypes, setPageCursor, setFilters]); useEffect(() => {