Skip to content

Commit

Permalink
Fixed syntax error causing screen to crash. Removed unnecessary state…
Browse files Browse the repository at this point in the history
… field
  • Loading branch information
rocky-fleek committed Oct 24, 2022
1 parent 88c2792 commit 4cc126b
Showing 1 changed file with 3 additions and 7 deletions.
10 changes: 3 additions & 7 deletions source/views/Extension/Views/WalletDetails/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -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;
Expand All @@ -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([]));
Expand All @@ -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));
}
});
}, []);
Expand Down

0 comments on commit 4cc126b

Please sign in to comment.