aboutsummaryrefslogtreecommitdiffstats
path: root/ui/app
diff options
context:
space:
mode:
authorWhymarrh Whitby <whymarrh.whitby@gmail.com>2018-08-23 02:58:17 +0800
committerGitHub <noreply@github.com>2018-08-23 02:58:17 +0800
commit171f6711d988cdfe04badee6f1b445a3abf513ad (patch)
tree7844a2eb8e5dfa3487f3f204a923600c3ca59456 /ui/app
parent21a6fdc1748424e84d12156552d344c622c03dd1 (diff)
parente803b8e047b5acad9143fe28d99d9e7d65211f46 (diff)
downloadtangerine-wallet-browser-171f6711d988cdfe04badee6f1b445a3abf513ad.tar
tangerine-wallet-browser-171f6711d988cdfe04badee6f1b445a3abf513ad.tar.gz
tangerine-wallet-browser-171f6711d988cdfe04badee6f1b445a3abf513ad.tar.bz2
tangerine-wallet-browser-171f6711d988cdfe04badee6f1b445a3abf513ad.tar.lz
tangerine-wallet-browser-171f6711d988cdfe04badee6f1b445a3abf513ad.tar.xz
tangerine-wallet-browser-171f6711d988cdfe04badee6f1b445a3abf513ad.tar.zst
tangerine-wallet-browser-171f6711d988cdfe04badee6f1b445a3abf513ad.zip
Merge pull request #5066 from whymarrh/fix-key-export
Don't re-render the export modal when the selected identity changes
Diffstat (limited to 'ui/app')
-rw-r--r--ui/app/components/modals/account-modal-container.js4
-rw-r--r--ui/app/components/modals/export-private-key-modal.js25
2 files changed, 19 insertions, 10 deletions
diff --git a/ui/app/components/modals/account-modal-container.js b/ui/app/components/modals/account-modal-container.js
index a9856b20f..aa0593df8 100644
--- a/ui/app/components/modals/account-modal-container.js
+++ b/ui/app/components/modals/account-modal-container.js
@@ -7,9 +7,9 @@ const actions = require('../../actions')
const { getSelectedIdentity } = require('../../selectors')
const Identicon = require('../identicon')
-function mapStateToProps (state) {
+function mapStateToProps (state, ownProps) {
return {
- selectedIdentity: getSelectedIdentity(state),
+ selectedIdentity: ownProps.selectedIdentity || getSelectedIdentity(state),
}
}
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(),
}, [