Skip to content

Commit

Permalink
filter out assets from curated assets with no icon_url
Browse files Browse the repository at this point in the history
  • Loading branch information
walmat committed May 24, 2024
1 parent 29ed2fc commit 884cdad
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ export const TokenToBuySection = ({ section }: { section: AssetToBuySection }) =

{/* TODO: fix this from causing the UI to be completely slow... */}
<AnimatedFlashListComponent
data={section.data.slice(0, 5)}
data={section.data.slice(0, 10)}
ListEmptyComponent={<ListEmpty />}
keyExtractor={item => `${item.uniqueId}-${section.id}`}
renderItem={({ item }) => (
Expand Down
3 changes: 2 additions & 1 deletion src/__swaps__/screens/Swap/hooks/useSearchCurrencyLists.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ import { isAddress } from '@ethersproject/address';
import { RainbowToken } from '@/entities';
import { useSwapContext } from '../providers/swap-provider';
import { userAssetsStore } from '@/state/assets/userAssets';
import { filterNonTokenIconAssets } from '../resources/_selectors/search';

export type AssetToBuySectionId = 'bridge' | 'favorites' | 'verified' | 'unverified' | 'other_networks';

Expand Down Expand Up @@ -75,7 +76,7 @@ export function useSearchCurrencyLists() {
// static search data
const { data: verifiedAssets, isLoading: verifiedAssetsLoading } = useTokenSearch(
{ list: 'verifiedAssets' },
{ staleTime: 60 * 60 * 1000, cacheTime: 24 * 60 * 60 * 1000 }
{ select: filterNonTokenIconAssets, staleTime: 60 * 60 * 1000, cacheTime: 24 * 60 * 60 * 1000 }
);

// current search
Expand Down
5 changes: 5 additions & 0 deletions src/__swaps__/screens/Swap/resources/_selectors/search.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
import { TokenSearchResult } from '../search';

export function filterNonTokenIconAssets(tokens: TokenSearchResult) {
return tokens.filter(token => token.icon_url);
}
2 changes: 1 addition & 1 deletion src/__swaps__/screens/Swap/resources/search/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ function parseTokenSearch(assets: SearchAsset[], chainId?: ChainId) {
}
}

type TokenSearchResult = QueryFunctionResult<typeof tokenSearchQueryFunction>;
export type TokenSearchResult = QueryFunctionResult<typeof tokenSearchQueryFunction>;

// ///////////////////////////////////////////////
// Query Fetcher
Expand Down

0 comments on commit 884cdad

Please sign in to comment.