@@ -14,7 +14,7 @@ import React, { useCallback, useMemo, useState } from 'react';
14
14
import { getValue } from '@polkadot/extension-polkagate/src/popup/account/util' ;
15
15
16
16
import { AssetLogo , FormatPrice , ShowBalance } from '../../../components' ;
17
- import { useApi , useNotifyOnChainChange , usePrices , useTranslation } from '../../../hooks' ;
17
+ import { useApi , useNotifyOnChainChange , usePrices , useSelectedChains , useTranslation } from '../../../hooks' ;
18
18
import getLogo2 from '../../../util/getLogo2' ;
19
19
20
20
interface Props {
@@ -120,6 +120,7 @@ function AOC ({ accountAssets, address, hideNumbers, mode = 'Detail', onclick, s
120
120
121
121
const api = useApi ( address ) ;
122
122
const pricesInCurrencies = usePrices ( ) ;
123
+ const selectedChains = useSelectedChains ( ) ;
123
124
124
125
useNotifyOnChainChange ( address ) ;
125
126
@@ -128,12 +129,14 @@ function AOC ({ accountAssets, address, hideNumbers, mode = 'Detail', onclick, s
128
129
const toggleAssets = useCallback ( ( ) => setShowMore ( ! showMore ) , [ showMore ] ) ;
129
130
130
131
const assets = useMemo ( ( ) => {
131
- if ( accountAssets && accountAssets . length > 0 ) {
132
- return accountAssets ;
132
+ if ( accountAssets && accountAssets . length > 0 && selectedChains ) {
133
+ // filter non selected chains
134
+
135
+ return accountAssets . filter ( ( { genesisHash } ) => selectedChains . includes ( genesisHash ) ) ;
133
136
} else {
134
137
return [ undefined , undefined ] ; // two undefined to show two skeletons
135
138
}
136
- } , [ accountAssets ] ) ;
139
+ } , [ accountAssets , selectedChains ] ) ;
137
140
138
141
const shouldShowCursor = useMemo ( ( ) => ( mode === 'Detail' && accountAssets && accountAssets . length > 5 ) || ( mode !== 'Detail' && accountAssets && accountAssets . length > 6 ) , [ accountAssets , mode ] ) ;
139
142
0 commit comments