1
0
mirror of https://github.com/kremalicious/metamask-extension.git synced 2024-12-23 09:52:26 +01:00

UX: Cleanup of NetworkListMenu properties (#20304)

This commit is contained in:
David Walsh 2023-08-01 13:17:48 -05:00 committed by GitHub
parent 24ca518315
commit 7ca418de1f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -105,7 +105,7 @@ export const NetworkListMenu = ({ onClose }) => {
} }
const generateMenuItems = (desiredNetworks) => { const generateMenuItems = (desiredNetworks) => {
return desiredNetworks.map((network, index) => { return desiredNetworks.map((network) => {
if (!lineaMainnetReleased && network.providerType === 'linea-mainnet') { if (!lineaMainnetReleased && network.providerType === 'linea-mainnet') {
return null; return null;
} }
@ -117,7 +117,7 @@ export const NetworkListMenu = ({ onClose }) => {
<NetworkListItem <NetworkListItem
name={network.nickname} name={network.nickname}
iconSrc={network?.rpcPrefs?.imageUrl} iconSrc={network?.rpcPrefs?.imageUrl}
key={`${network.id || network.chainId}-${index}`} key={network.id}
selected={isCurrentNetwork} selected={isCurrentNetwork}
focus={isCurrentNetwork && !showSearch} focus={isCurrentNetwork && !showSearch}
onClick={() => { onClick={() => {
@ -134,7 +134,7 @@ export const NetworkListMenu = ({ onClose }) => {
location: 'Network Menu', location: 'Network Menu',
chain_id: currentChainId, chain_id: currentChainId,
from_network: currentChainId, from_network: currentChainId,
to_network: network.id || network.chainId, to_network: network.chainId,
}, },
}); });
}} }}
@ -145,7 +145,7 @@ export const NetworkListMenu = ({ onClose }) => {
dispatch( dispatch(
showModal({ showModal({
name: 'CONFIRM_DELETE_NETWORK', name: 'CONFIRM_DELETE_NETWORK',
target: network.id || network.chainId, target: network.id,
onConfirm: () => undefined, onConfirm: () => undefined,
}), }),
); );