Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions packages/assets-controllers/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- Malicious tokens that slip through are caught by the periodic rescan (runs daily by default)
- Bump `@metamask/transaction-controller` from `^64.3.0` to `^64.4.0` ([#8585](https://github.com/MetaMask/core/pull/8585))

### Fixed

- Fix `selectAssetsBySelectedAccountGroup` crashing when an account referenced in the account tree is missing from internal accounts ([#8604](https://github.com/MetaMask/core/pull/8604))

## [104.3.0]

### Added
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -877,6 +877,18 @@ describe('token-selectors', () => {
expect(result).toStrictEqual(expectedMockResult);
});

it('skips accounts referenced in accountTree but missing from internalAccounts', () => {
const state = cloneDeep(mockedMergedState);

state.accountTree.wallets['entropy:01K1TJY9QPSCKNBSVGZNG510GJ'].groups[
'entropy:01K1TJY9QPSCKNBSVGZNG510GJ/0'
].accounts.push('non-existent-account-id');

const result = selectAssetsBySelectedAccountGroup(state);

expect(result).toStrictEqual(expectedMockResult);
});

it('returns no tokens if there is no selected account group', () => {
const result = selectAssetsBySelectedAccountGroup({
...mockedMergedState,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -140,6 +140,10 @@ const selectAccountsToGroupIdMap = createAssetListSelector(
for (const accountId of accounts) {
const internalAccount = internalAccounts.accounts[accountId];

if (!internalAccount) {
continue;
}

accountsMap[
// TODO: We would not need internalAccounts if evmTokens state had the accountId
internalAccount.type.startsWith('eip155')
Expand Down
Loading