Skip to content

Commit 9888c98

Browse files
committed
remove iterating through accounts list
1 parent 6b9544d commit 9888c98

File tree

1 file changed

+3
-9
lines changed

1 file changed

+3
-9
lines changed

app/components/UI/AccountSelectorList/AccountSelectorList.tsx

+3-9
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,9 @@ import { useNavigation } from '@react-navigation/native';
66
import { KeyringTypes } from '@metamask/keyring-controller';
77

88
// External dependencies.
9-
import { selectInternalAccounts } from '../../../selectors/accountsController';
109
import Cell, {
1110
CellVariant,
1211
} from '../../../component-library/components/Cells/Cell';
13-
import { InternalAccount } from '@metamask/keyring-internal-api';
1412
import { useStyles } from '../../../component-library/hooks';
1513
import { TextColor } from '../../../component-library/components/Texts/Text';
1614
import SensitiveText, {
@@ -68,8 +66,6 @@ const AccountSelectorList = ({
6866
: AvatarAccountType.JazzIcon,
6967
shallowEqual,
7068
);
71-
72-
const internalAccounts = useSelector(selectInternalAccounts);
7369
const getKeyExtractor = ({ address }: Account) => address;
7470

7571
const renderAccountBalances = useCallback(
@@ -177,10 +173,8 @@ const AccountSelectorList = ({
177173

178174
const onNavigateToAccountActions = useCallback(
179175
(selectedAccount: string) => {
180-
const account = internalAccounts.find(
181-
(accountData: InternalAccount) =>
182-
accountData.address.toLowerCase() === selectedAccount.toLowerCase(),
183-
);
176+
const account =
177+
Engine.context.AccountsController.getAccountByAddress(selectedAccount);
184178

185179
if (!account) return;
186180

@@ -189,7 +183,7 @@ const AccountSelectorList = ({
189183
params: { selectedAccount: account },
190184
});
191185
},
192-
[navigate, internalAccounts],
186+
[navigate],
193187
);
194188

195189
const renderAccountItem: ListRenderItem<Account> = useCallback(

0 commit comments

Comments
 (0)