Skip to content

Commit d8400cf

Browse files
authored
fix(core): fixed issue of tokens not showing in EVM domain (#4166)
* added check for evm empty portfolio * updated condition
1 parent f9dd1f1 commit d8400cf

2 files changed

Lines changed: 9 additions & 2 deletions

File tree

mobile-app/app/screens/AppNavigator/screens/Portfolio/PortfolioScreen.tsx

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -132,6 +132,7 @@ export function PortfolioScreen({ navigation }: Props): JSX.Element {
132132
const dispatch = useAppDispatch();
133133
const [refreshing, setRefreshing] = useState(false);
134134
const [isZeroBalance, setIsZeroBalance] = useState(true);
135+
const [isEvmZeroBalance, setIsEvmZeroBalance] = useState(true);
135136
const { hasFetchedToken, allTokens } = useSelector(
136137
(state: RootState) => state.wallet,
137138
);
@@ -455,7 +456,10 @@ export function PortfolioScreen({ navigation }: Props): JSX.Element {
455456
setIsZeroBalance(
456457
!tokens.some((token) => new BigNumber(token.amount).isGreaterThan(0)),
457458
);
458-
}, [tokens]);
459+
setIsEvmZeroBalance(
460+
!evmTokens.some((token) => new BigNumber(token.amount).isGreaterThan(0)),
461+
);
462+
}, [tokens, evmTokens]);
459463

460464
const assetSortBottomSheetScreen = useMemo(() => {
461465
return [
@@ -695,6 +699,7 @@ export function PortfolioScreen({ navigation }: Props): JSX.Element {
695699
) : (
696700
<PortfolioCard
697701
isZeroBalance={isZeroBalance}
702+
isEvmZeroBalance={isEvmZeroBalance}
698703
filteredTokens={sortTokensAssetOnType(assetSortType)}
699704
navigation={navigation}
700705
buttonGroupOptions={{

mobile-app/app/screens/AppNavigator/screens/Portfolio/components/PortfolioCard.tsx

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ import { EmptyEvmPortfolioIcon } from "../assets/EmptyEvmPortfolioIcon";
2222

2323
interface PortfolioCardProps {
2424
isZeroBalance: boolean;
25+
isEvmZeroBalance: boolean;
2526
filteredTokens: PortfolioRowToken[];
2627
navigation: StackNavigationProp<PortfolioParamList>;
2728
buttonGroupOptions?: {
@@ -35,6 +36,7 @@ interface PortfolioCardProps {
3536

3637
export function PortfolioCard({
3738
isZeroBalance,
39+
isEvmZeroBalance,
3840
filteredTokens,
3941
navigation,
4042
buttonGroupOptions,
@@ -44,7 +46,7 @@ export function PortfolioCard({
4446
const { hasFetchedToken } = useSelector((state: RootState) => state.wallet);
4547
const { domain } = useDomainContext();
4648
// return empty portfolio if no DFI and other tokens
47-
if (isZeroBalance) {
49+
if ((isZeroBalance && !isEvmDomain) || (isEvmZeroBalance && isEvmDomain)) {
4850
const screenDetails = getEmptyScreenDetails(
4951
ButtonGroupTabKey.AllTokens,
5052
domain,

0 commit comments

Comments
 (0)