From cbc11d4e8676dca6e3e7666551cf07fa2b320fb5 Mon Sep 17 00:00:00 2001 From: Nell Hardcastle Date: Mon, 6 May 2024 15:36:22 -0700 Subject: [PATCH] fix(app): Apply default search parameters on any initial render Fixes an issue where the portal pages would not have any search parameters applied. --- .../src/scripts/search/search-container.tsx | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/packages/openneuro-app/src/scripts/search/search-container.tsx b/packages/openneuro-app/src/scripts/search/search-container.tsx index 31739e2f1..4833db4a3 100644 --- a/packages/openneuro-app/src/scripts/search/search-container.tsx +++ b/packages/openneuro-app/src/scripts/search/search-container.tsx @@ -102,14 +102,12 @@ const SearchContainer: FC = ({ portalContent }) => { const { searchParams, setSearchParams } = useContext(SearchParamsCtx) const modality = portalContent?.modality || null - useEffect(() => { - setDefaultSearch( - modality, - searchParams, - setSearchParams, - new URLSearchParams(location.search), - ) - }, [modality, searchParams.modality_selected, setSearchParams, location]) + setDefaultSearch( + modality, + searchParams, + setSearchParams, + new URLSearchParams(location.search), + ) const { loading, data, fetchMore, refetch, variables, error } = useSearchResults()