From c438ba0a041724cac55b74f1287dbb8cfa00d606 Mon Sep 17 00:00:00 2001 From: EnzoVezzaro Date: Mon, 14 Feb 2022 16:33:46 +0100 Subject: [PATCH] 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 93dd57ae0b74b41c9baa18c9bb7dc76aa39e07cf. --- src/components/@shared/atoms/Tags.tsx | 4 +++- src/components/Search/index.tsx | 5 +++-- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/src/components/@shared/atoms/Tags.tsx b/src/components/@shared/atoms/Tags.tsx index 686789646..1a29a5f1d 100644 --- a/src/components/@shared/atoms/Tags.tsx +++ b/src/components/@shared/atoms/Tags.tsx @@ -15,7 +15,9 @@ const Tag = ({ tag, noLinks }: { tag: string; noLinks?: boolean }) => { return noLinks ? ( {tag} ) : ( - + {tag} diff --git a/src/components/Search/index.tsx b/src/components/Search/index.tsx index 1c93b0aaf..7979e3a9a 100644 --- a/src/components/Search/index.tsx +++ b/src/components/Search/index.tsx @@ -61,8 +61,9 @@ export default function SearchPage({ setTotalResults(undefined) const queryResult = await getResults(parsed, chainIds, newCancelToken()) setQueryResult(queryResult) - setTotalResults(queryResult.totalResults) - setTotalPagesNumber(queryResult.totalPages) + + setTotalResults(queryResult?.totalResults || 0) + setTotalPagesNumber(queryResult?.totalPages || 0) setLoading(false) }, [newCancelToken, setTotalPagesNumber, setTotalResults]