Skip to content

Commit

Permalink
[BX-1294] Fix missing wallets in Send flow (#1368)
Browse files Browse the repository at this point in the history
  • Loading branch information
BrodyHughes authored Mar 12, 2024
1 parent 1773c32 commit e854e6d
Showing 1 changed file with 4 additions and 23 deletions.
27 changes: 4 additions & 23 deletions src/entries/popup/pages/send/ToAddressInput.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ import { i18n } from '~/core/languages';
import { useCurrentAddressStore } from '~/core/state';
import { useTestnetModeStore } from '~/core/state/currentSettings/testnetMode';
import { usePopupInstanceStore } from '~/core/state/popupInstances';
import { useWalletOrderStore } from '~/core/state/walletOrder';
import { truncateAddress } from '~/core/utils/address';
import { TESTNET_MODE_BAR_HEIGHT } from '~/core/utils/dimensions';
import {
Expand Down Expand Up @@ -141,15 +140,6 @@ const WalletRow = ({
);
};

const sortWallets = (order: Address[], wallets: Address[]) =>
order.length
? order
.map((orderAddress) =>
wallets.find((address) => address === orderAddress),
)
.filter(Boolean)
: wallets;

const DropdownWalletsList = ({
wallets,
contacts,
Expand All @@ -161,18 +151,9 @@ const DropdownWalletsList = ({
watchedWallets: Address[];
selectWalletAndCloseDropdown: (address: Address) => void;
}) => {
const { walletOrder } = useWalletOrderStore();
const sortedWallets = useMemo(
() => sortWallets(walletOrder, wallets),
[wallets, walletOrder],
);
const sortedWatchedWallets = useMemo(
() => sortWallets(walletOrder, watchedWallets),
[watchedWallets, walletOrder],
);
const walletsExist = useMemo(
() => sortedWallets.length + contacts.length + watchedWallets.length > 0,
[contacts.length, sortedWallets.length, watchedWallets.length],
() => wallets.length + contacts.length + watchedWallets.length > 0,
[contacts.length, wallets.length, watchedWallets.length],
);

return (
Expand All @@ -183,7 +164,7 @@ const DropdownWalletsList = ({
<WalletSection
symbol="lock.square.stack.fill"
title={i18n.t('send.wallets_list.my_wallets')}
wallets={sortedWallets}
wallets={wallets}
onClickWallet={selectWalletAndCloseDropdown}
section="my_wallets"
/>
Expand All @@ -197,7 +178,7 @@ const DropdownWalletsList = ({
<WalletSection
symbol="eyes.inverse"
title={i18n.t('send.wallets_list.watched_wallets')}
wallets={sortedWatchedWallets}
wallets={watchedWallets}
onClickWallet={selectWalletAndCloseDropdown}
section="watching"
/>
Expand Down

0 comments on commit e854e6d

Please sign in to comment.