1
0
mirror of https://github.com/oceanprotocol/market.git synced 2024-12-02 05:57:29 +01:00

Fix mapping in search component and ux improvements (#1092)

* clear search input after submit

* fix mapping on sorting by tag (search query)

* fix property of undefined errors

* Revert "clear search input after submit"

This reverts commit 93dd57ae0b.
This commit is contained in:
EnzoVezzaro 2022-02-14 16:33:46 +01:00 committed by GitHub
parent 942ead1b4c
commit c438ba0a04
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 6 additions and 3 deletions

View File

@ -15,7 +15,9 @@ const Tag = ({ tag, noLinks }: { tag: string; noLinks?: boolean }) => {
return noLinks ? ( return noLinks ? (
<span className={styles.tag}>{tag}</span> <span className={styles.tag}>{tag}</span>
) : ( ) : (
<Link href={`/search?tags=${urlEncodedTag}&sort=created&sortOrder=desc`}> <Link
href={`/search?tags=${urlEncodedTag}&sort=metadata.created&sortOrder=desc`}
>
<a className={styles.tag} title={tag}> <a className={styles.tag} title={tag}>
{tag} {tag}
</a> </a>

View File

@ -61,8 +61,9 @@ export default function SearchPage({
setTotalResults(undefined) setTotalResults(undefined)
const queryResult = await getResults(parsed, chainIds, newCancelToken()) const queryResult = await getResults(parsed, chainIds, newCancelToken())
setQueryResult(queryResult) setQueryResult(queryResult)
setTotalResults(queryResult.totalResults)
setTotalPagesNumber(queryResult.totalPages) setTotalResults(queryResult?.totalResults || 0)
setTotalPagesNumber(queryResult?.totalPages || 0)
setLoading(false) setLoading(false)
}, },
[newCancelToken, setTotalPagesNumber, setTotalResults] [newCancelToken, setTotalPagesNumber, setTotalResults]