fix: hide invalid nft collections with 0 items from search bar (#7547)
fix: hide invalid collecitons with 0 items
This commit is contained in:
parent
46c8caa09c
commit
245d0eed06
@ -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 }
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user