From b15cc094ea1e01af62d76b6ff66456b790647b90 Mon Sep 17 00:00:00 2001 From: fmtabbara Date: Wed, 4 May 2022 10:00:17 +0100 Subject: [PATCH] small refactors --- .../components/Accounts/AccountContainer.tsx | 4 ++++ .../src/components/Accounts/Accounts.tsx | 4 ++-- nym-wallet/src/context/main.tsx | 20 +++++++++---------- nym-wallet/src/index.tsx | 12 +++++------ .../pages/sign-in/pages/signin-mnemonic.tsx | 5 +++-- 5 files changed, 24 insertions(+), 21 deletions(-) diff --git a/nym-wallet/src/components/Accounts/AccountContainer.tsx b/nym-wallet/src/components/Accounts/AccountContainer.tsx index 0a4f8b95e4..75c10316df 100644 --- a/nym-wallet/src/components/Accounts/AccountContainer.tsx +++ b/nym-wallet/src/components/Accounts/AccountContainer.tsx @@ -15,6 +15,10 @@ export const AccountsContainer = ({ storedAccounts }: { storedAccounts: AccountE if (selected) setSelectedAccount(selected); }, [accounts, storedAccounts]); + useEffect(() => { + setAccounts(storedAccounts); + }, [storedAccounts]); + const addAccount = async ({ accountName, mnemonic, diff --git a/nym-wallet/src/components/Accounts/Accounts.tsx b/nym-wallet/src/components/Accounts/Accounts.tsx index e0fd917b64..04d27f0dfb 100644 --- a/nym-wallet/src/components/Accounts/Accounts.tsx +++ b/nym-wallet/src/components/Accounts/Accounts.tsx @@ -22,7 +22,7 @@ export const Accounts = ({ setDialogToDisplay, }: { accounts?: AccountEntry[]; - selectedAccount: AccountEntry; + selectedAccount?: AccountEntry; accountToEdit?: AccountEntry; dialogToDisplay?: TDialog; addAccount: (acc: { accountName: string; mnemonic: string; password: string }) => Promise; @@ -32,7 +32,7 @@ export const Accounts = ({ setSelectedAccount: (accountName: string) => void; setDialogToDisplay: (dialog: TDialog | undefined) => void; }) => - accounts ? ( + accounts && selectedAccount ? ( <>