From 4cc126b74c815fc543a4b3a34c7454a5802a7771 Mon Sep 17 00:00:00 2001 From: rocky-fleek Date: Mon, 24 Oct 2022 14:53:02 -0600 Subject: [PATCH 1/2] Fixed syntax error causing screen to crash. Removed unnecessary state field --- source/views/Extension/Views/WalletDetails/index.jsx | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/source/views/Extension/Views/WalletDetails/index.jsx b/source/views/Extension/Views/WalletDetails/index.jsx index 261966ae..d9a8fed4 100644 --- a/source/views/Extension/Views/WalletDetails/index.jsx +++ b/source/views/Extension/Views/WalletDetails/index.jsx @@ -64,7 +64,6 @@ const WalletDetails = () => { const [connectedWallets, setConnectedWallets] = useState([]); const [tab, setTab] = useState(null); const [app, setApp] = useState(null); - const [accountSwitchId, setAccountSwitchId] = useState(walletId); const [accounts, setAccounts] = useState([]); const [openEmojis, setOpenEmojis] = useState(false); const [walletName, setWalletName] = useState(name); @@ -218,9 +217,6 @@ const WalletDetails = () => { const url = getTabURL(tabs?.[0]); const ids = accounts.map((account) => account.walletId); setTab(tabs?.[0]); - // Check if new wallet is connected to the current page - setAccountSwitchId(walletId); - if (!ids.length) { executeAccountSwitch(walletId); return; @@ -246,12 +242,12 @@ const WalletDetails = () => { }; const executeAccountSwitch = (wallet) => { - sendMessage({ type: HANDLER_TYPES.SET_CURRENT_PRINCIPAL, params: accountSwitchId }, + sendMessage({ type: HANDLER_TYPES.SET_CURRENT_PRINCIPAL, params: wallet }, (state) => { if (Object.values(state?.wallets).length) { const newWallet = state.wallets[state.currentWalletId]; dispatch(setAccountInfo(newWallet)); - dipatch(getContacts()); + dispatch(getContacts()); dispatch(setICNSData(newWallet.icnsData)); dispatch(setAssetsLoading(true)); dispatch(setTransactions([])); @@ -275,7 +271,7 @@ const WalletDetails = () => { useEffect(() => { sendMessage({ type: HANDLER_TYPES.GET_STATE, params: {} }, (state) => { if (Object.keys(state?.wallets)?.length) { - setAccounts(state.wallets); + setAccounts(Object.values(state.wallets)); } }); }, []); From 065bc0f96052ded85dd7b1aa9d830d973fce35d1 Mon Sep 17 00:00:00 2001 From: rocky-fleek Date: Mon, 24 Oct 2022 14:57:33 -0600 Subject: [PATCH 2/2] Fixed issue where account switch only happened if clicking on the account name --- source/components/Profile/components/AccountItem/index.jsx | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/source/components/Profile/components/AccountItem/index.jsx b/source/components/Profile/components/AccountItem/index.jsx index 3444f33a..4676c777 100644 --- a/source/components/Profile/components/AccountItem/index.jsx +++ b/source/components/Profile/components/AccountItem/index.jsx @@ -40,11 +40,9 @@ const AccountItem = ({ classes.accountItemContainer, isHidden && classes.hiddenAccount, )} + onClick={(e) => handleChangeAccount(e, account.walletId)} > -
handleChangeAccount(e, account.walletId)} - className={classes.leftContainer} - > +