Skip to content

Commit

Permalink
refactor(swap): improve buy list performance
Browse files Browse the repository at this point in the history
  • Loading branch information
banklesss committed Oct 18, 2023
1 parent ab79a08 commit cc0304a
Showing 1 changed file with 3 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ const TokenList = () => {
keyExtractor={({info: {id, name}}) => `${name}-${id}`}
testID="assetsList"
estimatedItemSize={72}
ListEmptyComponent={<EmptyList filteredTokensForList={filteredTransformedList} balances={balances} />}
ListEmptyComponent={<EmptyList filteredTokensForList={filteredTransformedList} />}
/>

<Spacer height={16} />
Expand Down Expand Up @@ -178,17 +178,10 @@ const SelectableToken = ({wallet, token, walletTokenIds}: SelectableTokenProps)
)
}

const EmptyList = ({
filteredTokensForList,
balances,
}: {
filteredTokensForList: Array<Balance.Token>
balances: Balance.Amounts
}) => {
const EmptyList = ({filteredTokensForList}: {filteredTokensForList: Array<Balance.Token>}) => {
const {search: assetSearchTerm, visible: isSearching} = useSearch()
const hasTokenBalance = Object.keys(balances).length === 1

if ((isSearching && assetSearchTerm.length > 0 && filteredTokensForList.length === 0) || hasTokenBalance)
if (isSearching && assetSearchTerm.length > 0 && filteredTokensForList.length === 0)
return <EmptySearchResult assetSearchTerm={assetSearchTerm} />

return null
Expand Down

0 comments on commit cc0304a

Please sign in to comment.