improved query string handling
This commit is contained in:
parent
33476e7fc5
commit
3bd4f2d4c8
1 changed files with 8 additions and 4 deletions
|
@ -137,6 +137,7 @@ function _Search() {
|
||||||
const [searchInput, setSearchInput] = useState(query.query)
|
const [searchInput, setSearchInput] = useState(query.query)
|
||||||
|
|
||||||
function doSearch() {
|
function doSearch() {
|
||||||
|
// remove focus from search bar to prevent accidental multiple search
|
||||||
if (inputRef.current) inputRef.current.blur()
|
if (inputRef.current) inputRef.current.blur()
|
||||||
|
|
||||||
_history.push({
|
_history.push({
|
||||||
|
@ -220,7 +221,9 @@ function _Search() {
|
||||||
...(query.to && {
|
...(query.to && {
|
||||||
to: query.to,
|
to: query.to,
|
||||||
}),
|
}),
|
||||||
tags: query.tags.join(","),
|
...(query.tags.length > 0 && {
|
||||||
|
tags: query.tags.join(","),
|
||||||
|
}),
|
||||||
}
|
}
|
||||||
|
|
||||||
// convert Date to YYYY-MM-DD string if it exists
|
// convert Date to YYYY-MM-DD string if it exists
|
||||||
|
@ -262,9 +265,10 @@ function _Search() {
|
||||||
<br />
|
<br />
|
||||||
<small>
|
<small>
|
||||||
<TagList>
|
<TagList>
|
||||||
{query.tags?.map((tag) => {
|
{query.tags.length > 0 &&
|
||||||
return <Tag key={tag} text={tag} />
|
query.tags.map((tag) => {
|
||||||
})}
|
return <Tag key={tag} text={tag} />
|
||||||
|
})}
|
||||||
</TagList>
|
</TagList>
|
||||||
</small>
|
</small>
|
||||||
<br />
|
<br />
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue