diff --git a/themes/NEXT/components/SearchInput.js b/themes/NEXT/components/SearchInput.js index 25dc8ccb..73aa521b 100644 --- a/themes/NEXT/components/SearchInput.js +++ b/themes/NEXT/components/SearchInput.js @@ -4,7 +4,7 @@ import { useImperativeHandle, useRef, useState } from 'react' const SearchInput = ({ currentTag, currentSearch, cRef }) => { const { locale } = useGlobal() - const [searchKey, setSearchKey] = useState(currentSearch || '') + // const [searchKey, setSearchKey] = useState(currentSearch || '') const [onLoading, setLoadingState] = useState(false) const router = useRouter() const searchInputRef = useRef() @@ -36,11 +36,10 @@ const SearchInput = ({ currentTag, currentSearch, cRef }) => { } const cleanSearch = () => { searchInputRef.current.value = '' - setSearchKey('') } const updateSearchKey = (val) => { - setSearchKey(val) + searchInputRef.current.value = val } return
@@ -51,12 +50,12 @@ const SearchInput = ({ currentTag, currentSearch, cRef }) => { className={'w-full text-sm pl-4 transition focus:shadow-lg font-light leading-10 border-gray-300 text-black bg-gray-100 dark:bg-gray-900 dark:text-white'} onKeyUp={handleKeyUp} onChange={e => updateSearchKey(e.target.value)} - defaultValue={searchKey} + defaultValue={currentSearch} /> - {(searchKey && searchKey.length && )} + {(currentSearch && currentSearch.length > 0 && )}
{ handleSearch(searchKey) }}> + onClick={handleSearch}>