aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDan Finlay <dan@danfinlay.com>2016-11-22 12:08:36 +0800
committerDan Finlay <dan@danfinlay.com>2016-11-22 12:08:36 +0800
commitea56426b2355c1076c18256fb0b4e74f47ff4b39 (patch)
tree08b86f5f97838c863193d5e8bd996807da36cc23
parentecfda5bcc54bc444f3620a18a561847d0d2634dd (diff)
downloadtangerine-wallet-browser-ea56426b2355c1076c18256fb0b4e74f47ff4b39.tar.gz
tangerine-wallet-browser-ea56426b2355c1076c18256fb0b4e74f47ff4b39.tar.zst
tangerine-wallet-browser-ea56426b2355c1076c18256fb0b4e74f47ff4b39.zip
Use callback in placeSeedWord method.
When displaying seed words, we were not using a callback, which had some race condition potential. This is simply a little cleaner and more correct. Fixes #842
-rw-r--r--app/scripts/keyring-controller.js7
-rw-r--r--ui/app/actions.js6
2 files changed, 10 insertions, 3 deletions
diff --git a/app/scripts/keyring-controller.js b/app/scripts/keyring-controller.js
index cf761c88c..49a41df66 100644
--- a/app/scripts/keyring-controller.js
+++ b/app/scripts/keyring-controller.js
@@ -173,10 +173,15 @@ module.exports = class KeyringController extends EventEmitter {
})
}
- placeSeedWords () {
+ placeSeedWords (cb) {
const firstKeyring = this.keyrings[0]
const seedWords = firstKeyring.serialize().mnemonic
this.configManager.setSeedWords(seedWords)
+
+ if (cb && typeof cb === 'function') {
+ cb()
+ this.emit('update')
+ }
}
submitPassword (password, cb) {
diff --git a/ui/app/actions.js b/ui/app/actions.js
index e69b743e9..4a5507d33 100644
--- a/ui/app/actions.js
+++ b/ui/app/actions.js
@@ -221,9 +221,11 @@ function requestRevealSeed (password) {
return (dispatch) => {
dispatch(actions.showLoadingIndication())
background.submitPassword(password, (err) => {
- dispatch(actions.hideLoadingIndication())
if (err) return dispatch(actions.displayWarning(err.message))
- background.placeSeedWords()
+ background.placeSeedWords((err) => {
+ if (err) return dispatch(actions.displayWarning(err.message))
+ dispatch(actions.hideLoadingIndication())
+ })
})
}
}