fix: fix saerch query change on explore

Signed-off-by: Raul Kele <raulkeleblk@gmail.com>
This commit is contained in:
Raul Kele 2023-02-14 15:47:05 +02:00
parent a40801f75e
commit c9c058a350

View File

@ -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(':')) {