Skip to content

Commit

Permalink
make defaultToken appear at the top of the owned section of the dropd…
Browse files Browse the repository at this point in the history
…own with full renderable data regardless of whether swaps tokens are available
  • Loading branch information
adonesky1 committed Oct 21, 2021
1 parent 6b22e5a commit a5171c4
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions ui/hooks/useTokensToSearch.js
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,9 @@ export function useTokensToSearch({
: [
memoizedDefaultToken,
...shuffledTokenList.filter(
(token) => token.symbol !== memoizedDefaultToken.symbol,
(token) =>
token.symbol !== memoizedDefaultToken.symbol &&
token.address !== memoizedDefaultToken.address,
),
];

Expand All @@ -140,13 +142,13 @@ export function useTokensToSearch({
};

const memoizedSwapsAndUserTokensWithoutDuplicities = uniqBy(
[...memoizedTokensToSearch, ...memoizedUsersToken],
[memoizedDefaultToken, ...memoizedTokensToSearch, ...memoizedUsersToken],
(token) => token.address.toLowerCase(),
);

memoizedSwapsAndUserTokensWithoutDuplicities.forEach((token) => {
const renderableDataToken = getRenderableTokenData(
{ ...token, ...usersTokensAddressMap[token.address.toLowerCase()] },
{ ...usersTokensAddressMap[token.address.toLowerCase()], ...token },
tokenConversionRates,
conversionRate,
currentCurrency,
Expand Down Expand Up @@ -186,6 +188,7 @@ export function useTokensToSearch({
conversionRate,
currentCurrency,
memoizedTopTokens,
memoizedDefaultToken,
chainId,
tokenList,
useTokenDetection,
Expand Down

0 comments on commit a5171c4

Please sign in to comment.