diff --git a/app/src/components/Common.js b/app/src/components/Common.js index def9e409..33792b7c 100644 --- a/app/src/components/Common.js +++ b/app/src/components/Common.js @@ -405,6 +405,16 @@ const useClearableInput = (searchStr, onChange, onClear, onSubmit, size = 'small const [value, setValue] = useState(searchStr || ''); const [submitted, setSubmitted] = useState(false); + React.useEffect(() => { + // Search was changed above. + if (searchStr !== value) { + setValue(searchStr); + } + if (!searchStr) { + setValue(''); + } + }, [searchStr, value]); + const handleChange = (e) => { if (e) { e.preventDefault(); diff --git a/app/src/components/Search.js b/app/src/components/Search.js index 20554bc1..da959c40 100644 --- a/app/src/components/Search.js +++ b/app/src/components/Search.js @@ -165,7 +165,7 @@ export function useSearchSuggestions(defaultSearchStr, defaultTagNames) { title: newSuggestions.fileGroups.toString(), type: 'files', // Add search query onto current location. - location: getLocationStr({q: encodeURIComponent(searchStr)}, '/search') + location: getLocationStr({q: searchStr}, '/search'), } ] };