From b3b06896bec8e3f324516dcf18c23b124aa78e96 Mon Sep 17 00:00:00 2001 From: James Grugett Date: Fri, 5 Aug 2022 17:44:55 -0700 Subject: [PATCH] Add loading indicator when algolia search is initially loading --- web/components/contract-search.tsx | 2 +- web/components/contract/contracts-list.tsx | 7 ++++++- web/pages/contract-search-firestore.tsx | 17 ++++++----------- 3 files changed, 13 insertions(+), 13 deletions(-) diff --git a/web/components/contract-search.tsx b/web/components/contract-search.tsx index c1e63175..607a4668 100644 --- a/web/components/contract-search.tsx +++ b/web/components/contract-search.tsx @@ -343,7 +343,7 @@ export function ContractSearch(props: { <>You're not following anyone, nor in any of your own groups yet. ) : ( void hasMore: boolean showTime?: ShowTime @@ -49,6 +50,10 @@ export function ContractsGrid(props: { } }, [isBottomVisible, hasMore, loadMore]) + if (contracts === undefined) { + return + } + if (contracts.length === 0) { return (

diff --git a/web/pages/contract-search-firestore.tsx b/web/pages/contract-search-firestore.tsx index 9039aa50..7bb42a05 100644 --- a/web/pages/contract-search-firestore.tsx +++ b/web/pages/contract-search-firestore.tsx @@ -3,7 +3,6 @@ import { searchInAny } from 'common/util/parse' import { sortBy } from 'lodash' import { useState } from 'react' import { ContractsGrid } from 'web/components/contract/contracts-list' -import { LoadingIndicator } from 'web/components/loading-indicator' import { useContracts } from 'web/hooks/use-contracts' import { Sort, @@ -118,16 +117,12 @@ export default function ContractSearchFirestore(props: { - {contracts === undefined ? ( - - ) : ( - {}} - hasMore={false} - showTime={showTime} - /> - )} + {}} + hasMore={false} + showTime={showTime} + /> ) }