diff options
author | Whymarrh Whitby <whymarrh.whitby@gmail.com> | 2018-08-15 01:12:30 +0800 |
---|---|---|
committer | Whymarrh Whitby <whymarrh.whitby@gmail.com> | 2018-08-23 02:08:34 +0800 |
commit | 1e8e8bdfc87903249320b97d569c64c55a524899 (patch) | |
tree | 231a47f9448e8628be35f6b316c91f0d404899f6 /ui | |
parent | a90c152485b84d6b382218543a6b38918a3ce6cf (diff) | |
download | tangerine-wallet-browser-1e8e8bdfc87903249320b97d569c64c55a524899.tar.gz tangerine-wallet-browser-1e8e8bdfc87903249320b97d569c64c55a524899.tar.zst tangerine-wallet-browser-1e8e8bdfc87903249320b97d569c64c55a524899.zip |
Don't re-render the export modal when the selected identity changes
Diffstat (limited to 'ui')
-rw-r--r-- | ui/app/components/modals/export-private-key-modal.js | 25 |
1 files changed, 17 insertions, 8 deletions
diff --git a/ui/app/components/modals/export-private-key-modal.js b/ui/app/components/modals/export-private-key-modal.js index 80ece425f..99b61bf9d 100644 --- a/ui/app/components/modals/export-private-key-modal.js +++ b/ui/app/components/modals/export-private-key-modal.js @@ -11,13 +11,21 @@ const ReadOnlyInput = require('../readonly-input') const copyToClipboard = require('copy-to-clipboard') const { checksumAddress } = require('../../util') -function mapStateToProps (state) { - return { - warning: state.appState.warning, - privateKey: state.appState.accountDetail.privateKey, - network: state.metamask.network, - selectedIdentity: getSelectedIdentity(state), - previousModalState: state.appState.modal.previousModalState.name, +function mapStateToPropsFactory () { + let selectedIdentity = null + return function mapStateToProps (state) { + // We should **not** change the identity displayed here even if it changes from underneath us. + // If we do, we will be showing the user one private key and a **different** address and name. + // Note that the selected identity **will** change from underneath us when we unlock the keyring + // which is the expected behavior that we are side-stepping. + selectedIdentity = selectedIdentity || getSelectedIdentity(state) + return { + warning: state.appState.warning, + privateKey: state.appState.accountDetail.privateKey, + network: state.metamask.network, + selectedIdentity, + previousModalState: state.appState.modal.previousModalState.name, + } } } @@ -43,7 +51,7 @@ ExportPrivateKeyModal.contextTypes = { t: PropTypes.func, } -module.exports = connect(mapStateToProps, mapDispatchToProps)(ExportPrivateKeyModal) +module.exports = connect(mapStateToPropsFactory, mapDispatchToProps)(ExportPrivateKeyModal) ExportPrivateKeyModal.prototype.exportAccountAndGetPrivateKey = function (password, address) { @@ -113,6 +121,7 @@ ExportPrivateKeyModal.prototype.render = function () { const { privateKey } = this.state return h(AccountModalContainer, { + selectedIdentity, showBackButton: previousModalState === 'ACCOUNT_DETAILS', backButtonAction: () => showAccountDetailModal(), }, [ |