From 83fdbb0f58b131de11db1f3741d980e58e34e1a1 Mon Sep 17 00:00:00 2001 From: Gabriel Date: Mon, 20 Jan 2025 17:43:09 -0300 Subject: [PATCH] [FIX] avoid error if all accounts are hidden --- .../wallet/screens/AccountDetails.tsx | 40 +++++++++---------- .../wallet/screens/AccountSettings.tsx | 1 + src/store/wallet/utils/wallet.ts | 4 +- 3 files changed, 23 insertions(+), 22 deletions(-) diff --git a/src/navigation/wallet/screens/AccountDetails.tsx b/src/navigation/wallet/screens/AccountDetails.tsx index 1f658e34a..fa6ea0e8c 100644 --- a/src/navigation/wallet/screens/AccountDetails.tsx +++ b/src/navigation/wallet/screens/AccountDetails.tsx @@ -378,22 +378,22 @@ const AccountDetails: React.FC = ({route}) => { const memorizedAccountList = useMemo(() => { return buildAccountList(key, defaultAltCurrency.isoCode, rates, dispatch, { filterByHideWallet: true, - }).filter(({chains}) => IsEVMChain(chains[0])); + }).filter(({chains}) => IsEVMChain(chains[0])) || {}; }, [dispatch, key, defaultAltCurrency.isoCode, rates]); const accountItem = memorizedAccountList.find( a => a.receiveAddress === selectedAccountAddress, )!; - const totalBalance = accountItem.fiatBalanceFormat; + const totalBalance = accountItem?.fiatBalanceFormat; const hasMultipleAccounts = memorizedAccountList.length > 1; const accounts = useAppSelector( - ({SHOP}) => SHOP.billPayAccounts[accountItem.wallets[0].network], + ({SHOP}) => SHOP.billPayAccounts[accountItem?.wallets[0]?.network], ); const keyOptions: Array