From c9c058a35022f333ddd03b1efcf67a71388f0726 Mon Sep 17 00:00:00 2001 From: Raul Kele Date: Tue, 14 Feb 2023 15:47:05 +0200 Subject: [PATCH] fix: fix saerch query change on explore Signed-off-by: Raul Kele --- src/components/Header/SearchSuggestion.jsx | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/components/Header/SearchSuggestion.jsx b/src/components/Header/SearchSuggestion.jsx index 1f6fe2ad..bae5f59b 100644 --- a/src/components/Header/SearchSuggestion.jsx +++ b/src/components/Header/SearchSuggestion.jsx @@ -96,7 +96,7 @@ const useStyles = makeStyles(() => ({ })); function SearchSuggestion() { - const [queryParams] = useSearchParams(); + const [queryParams, setQueryParams] = useSearchParams(); const search = queryParams.get('search'); const [searchQuery, setSearchQuery] = useState(search || ''); @@ -180,6 +180,7 @@ function SearchSuggestion() { }; const searchCall = (value) => { + setQueryParams((prevState) => createSearchParams({ ...prevState, search: searchQuery })); if (value !== '') { // if search term inclused the ':' character, search for images, if not, search repos if (value?.includes(':')) {