fix: hide invalid nft collections with 0 items from search bar (#7547)

fix: hide invalid collecitons with 0 items
This commit is contained in:
Charles Bachmeier 2023-11-08 09:21:14 -08:00 committed by GitHub
parent 46c8caa09c
commit 245d0eed06
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -82,9 +82,11 @@ export function useCollectionSearch(queryOrAddress: string): useCollectionSearch
const isName = !isAddress(queryOrAddress.toLowerCase()) const isName = !isAddress(queryOrAddress.toLowerCase())
const queryResult = useCollectionQuerySearch(queryOrAddress, /* skip= */ !isName) const queryResult = useCollectionQuerySearch(queryOrAddress, /* skip= */ !isName)
const addressResult = useCollection(queryOrAddress, /* skip= */ isName) const addressResult = useCollection(queryOrAddress, /* skip= */ isName)
const invalidCollectionAddress =
blocklistedCollections.includes(queryOrAddress) || !addressResult.data.stats?.total_supply
return isName return isName
? queryResult ? queryResult
: blocklistedCollections.includes(queryOrAddress) : invalidCollectionAddress
? { data: [], loading: false } ? { data: [], loading: false }
: { data: [addressResult.data], loading: addressResult.loading } : { data: [addressResult.data], loading: addressResult.loading }
} }