Skip to content

Commit

Permalink
fix: ignore error when getting address info on address management page
Browse files Browse the repository at this point in the history
  • Loading branch information
heisenberg-2077 committed Sep 14, 2023
1 parent 1a14dfc commit 0314822
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 7 deletions.
2 changes: 1 addition & 1 deletion src/ui/views/HDManager/AccountList.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ export const AccountList: React.FC<Props> = ({

React.useEffect(() => {
if (!hiddenInfo) {
createTask(() => fetchAccountsInfo(wallet, data ?? []).then(setList));
fetchAccountsInfo(wallet, data ?? []).then(setList);
} else {
setList(data ?? []);
}
Expand Down
15 changes: 9 additions & 6 deletions src/ui/views/HDManager/utils.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import * as Sentry from '@sentry/browser';
import { KEYRING_CLASS } from '@/constant';
import { useRabbyDispatch } from '@/ui/store';
import { useTranslation } from 'react-i18next';
import { isFunction } from 'lodash';

export const sleep = (ms: number) =>
new Promise((resolve) => setTimeout(resolve, ms));
Expand Down Expand Up @@ -40,7 +41,7 @@ export const fetchAccountsInfo = async (
}
}

let chains: Account['chains'];
let chains: Account['chains'] = [];
try {
chains = await wallet.openapi.usedChainList(account.address);
} catch (e) {
Expand All @@ -59,11 +60,13 @@ export const fetchAccountsInfo = async (
}

// find firstTxTime
chains?.forEach((chain: any) => {
if (chain.born_at) {
firstTxTime = Math.min(firstTxTime ?? Infinity, chain.born_at);
}
});
if (isFunction(chains?.forEach)) {
chains?.forEach((chain: any) => {
if (chain.born_at) {
firstTxTime = Math.min(firstTxTime ?? Infinity, chain.born_at);
}
});
}

const accountInfo: Account = {
...account,
Expand Down

0 comments on commit 0314822

Please sign in to comment.