Skip to content

Commit

Permalink
fix(core): fixed issue of tokens not showing in EVM domain (#4166)
Browse files Browse the repository at this point in the history
* added check for evm empty portfolio

* updated condition
  • Loading branch information
nattadex authored Jan 22, 2024
1 parent f9dd1f1 commit d8400cf
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,7 @@ export function PortfolioScreen({ navigation }: Props): JSX.Element {
const dispatch = useAppDispatch();
const [refreshing, setRefreshing] = useState(false);
const [isZeroBalance, setIsZeroBalance] = useState(true);
const [isEvmZeroBalance, setIsEvmZeroBalance] = useState(true);
const { hasFetchedToken, allTokens } = useSelector(
(state: RootState) => state.wallet,
);
Expand Down Expand Up @@ -455,7 +456,10 @@ export function PortfolioScreen({ navigation }: Props): JSX.Element {
setIsZeroBalance(
!tokens.some((token) => new BigNumber(token.amount).isGreaterThan(0)),
);
}, [tokens]);
setIsEvmZeroBalance(
!evmTokens.some((token) => new BigNumber(token.amount).isGreaterThan(0)),
);
}, [tokens, evmTokens]);

const assetSortBottomSheetScreen = useMemo(() => {
return [
Expand Down Expand Up @@ -695,6 +699,7 @@ export function PortfolioScreen({ navigation }: Props): JSX.Element {
) : (
<PortfolioCard
isZeroBalance={isZeroBalance}
isEvmZeroBalance={isEvmZeroBalance}
filteredTokens={sortTokensAssetOnType(assetSortType)}
navigation={navigation}
buttonGroupOptions={{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ import { EmptyEvmPortfolioIcon } from "../assets/EmptyEvmPortfolioIcon";

interface PortfolioCardProps {
isZeroBalance: boolean;
isEvmZeroBalance: boolean;
filteredTokens: PortfolioRowToken[];
navigation: StackNavigationProp<PortfolioParamList>;
buttonGroupOptions?: {
Expand All @@ -35,6 +36,7 @@ interface PortfolioCardProps {

export function PortfolioCard({
isZeroBalance,
isEvmZeroBalance,
filteredTokens,
navigation,
buttonGroupOptions,
Expand All @@ -44,7 +46,7 @@ export function PortfolioCard({
const { hasFetchedToken } = useSelector((state: RootState) => state.wallet);
const { domain } = useDomainContext();
// return empty portfolio if no DFI and other tokens
if (isZeroBalance) {
if ((isZeroBalance && !isEvmDomain) || (isEvmZeroBalance && isEvmDomain)) {
const screenDetails = getEmptyScreenDetails(
ButtonGroupTabKey.AllTokens,
domain,
Expand Down

0 comments on commit d8400cf

Please sign in to comment.