diff --git a/src/components/modals/AddAccount/index.js b/src/components/modals/AddAccount/index.js index 0b5e008e..dda994d4 100644 --- a/src/components/modals/AddAccount/index.js +++ b/src/components/modals/AddAccount/index.js @@ -134,6 +134,19 @@ class AddAccountModal extends PureComponent { ipcRenderer.on('msg', this.handleWalletRequest) } + componentWillReceiveProps(nextProps) { + if (nextProps.accounts) { + this.setState(prev => ({ + accounts: Object.keys(prev.accounts).reduce((result, value) => { + if (!nextProps.accounts[value]) { + result[value] = prev.accounts[value] + } + return result + }, {}), + })) + } + } + componentDidUpdate() { const { step } = this.state const { currentDevice } = this.props diff --git a/src/internals/usb/wallet/accounts.js b/src/internals/usb/wallet/accounts.js index 620fce5b..5513381e 100644 --- a/src/internals/usb/wallet/accounts.js +++ b/src/internals/usb/wallet/accounts.js @@ -122,7 +122,7 @@ export default async ({ const hasTransactions = account.transactions.length > 0 - accounts[currentAccount] = { + accounts[xpub58] = { id: xpub58, ...account, } diff --git a/src/internals/usb/wallet/index.js b/src/internals/usb/wallet/index.js index f00ab756..3e79c0b1 100644 --- a/src/internals/usb/wallet/index.js +++ b/src/internals/usb/wallet/index.js @@ -31,6 +31,7 @@ export default (sendEvent: Function) => ({ currentAccounts, onProgress: progress => sendEvent('wallet.getAccounts.progress', progress, { kill: false }), }) + sendEvent('wallet.getAccounts.success', data) } catch (err) { sendEvent('wallet.getAccounts.fail', err.stack || err)