diff --git a/frontend/src/components/AppGrid.jsx b/frontend/src/components/AppGrid.jsx index 57369deb..2d0e9d3d 100644 --- a/frontend/src/components/AppGrid.jsx +++ b/frontend/src/components/AppGrid.jsx @@ -3,6 +3,7 @@ import React, {useEffect, useState} from 'react'; import theme from '../theme.jsx'; import ReactGA from 'react-ga4'; import {Link} from 'react-router-dom'; +import { removeQuery } from '../components/ScrollToTop.jsx'; import { Search as SearchIcon, @@ -89,21 +90,24 @@ const AppGrid = props => { } const SearchBox = ({currentRefinement, refine, isSearchStalled} ) => { - useEffect(() => { - if (window !== undefined && window.location !== undefined && window.location.search !== undefined && window.location.search !== null) { - const urlSearchParams = new URLSearchParams(window.location.search) - const params = Object.fromEntries(urlSearchParams.entries()) - const foundQuery = params["q"] - if (foundQuery !== null && foundQuery !== undefined) { - console.log("Got query: ", foundQuery) - refine(foundQuery) - } + var defaultSearch = "" + //useEffect(() => { + if (window !== undefined && window.location !== undefined && window.location.search !== undefined && window.location.search !== null) { + const urlSearchParams = new URLSearchParams(window.location.search) + const params = Object.fromEntries(urlSearchParams.entries()) + const foundQuery = params["q"] + if (foundQuery !== null && foundQuery !== undefined) { + console.log("Got query: ", foundQuery) + refine(foundQuery) + defaultSearch = foundQuery } - }, []) + } + //}, []) return (