mirror of
https://github.com/lrnselfreliance/wrolpi.git
synced 2026-11-21 07:26:18 -05:00
Do not need to encode query. Clearing search input when user navigates to dashboard.
This commit is contained in:
parent
47b9d6618c
commit
6409e0ffde
2 changed files with 11 additions and 1 deletions
|
|
@ -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();
|
||||
|
|
|
|||
|
|
@ -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'),
|
||||
}
|
||||
]
|
||||
};
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue