aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDan Finlay <dan@danfinlay.com>2018-06-05 05:24:45 +0800
committerDan Finlay <dan@danfinlay.com>2018-06-05 05:24:45 +0800
commitb858cc4b1bf13c7c813fe48bb0b12f9eb3cc4a0d (patch)
treeb8fe266599748c61785df91a38fdb9aedbb09b75
parentf3b385cb093cbd9706643c0feae2702adfcc11da (diff)
downloadtangerine-wallet-browser-b858cc4b1bf13c7c813fe48bb0b12f9eb3cc4a0d.tar
tangerine-wallet-browser-b858cc4b1bf13c7c813fe48bb0b12f9eb3cc4a0d.tar.gz
tangerine-wallet-browser-b858cc4b1bf13c7c813fe48bb0b12f9eb3cc4a0d.tar.bz2
tangerine-wallet-browser-b858cc4b1bf13c7c813fe48bb0b12f9eb3cc4a0d.tar.lz
tangerine-wallet-browser-b858cc4b1bf13c7c813fe48bb0b12f9eb3cc4a0d.tar.xz
tangerine-wallet-browser-b858cc4b1bf13c7c813fe48bb0b12f9eb3cc4a0d.tar.zst
tangerine-wallet-browser-b858cc4b1bf13c7c813fe48bb0b12f9eb3cc4a0d.zip
Only notify first time lost ids are detected
-rw-r--r--app/scripts/controllers/preferences.js10
1 files changed, 8 insertions, 2 deletions
diff --git a/app/scripts/controllers/preferences.js b/app/scripts/controllers/preferences.js
index cff70272f..038bab37b 100644
--- a/app/scripts/controllers/preferences.js
+++ b/app/scripts/controllers/preferences.js
@@ -111,15 +111,17 @@ class PreferencesController {
*/
syncAddresses (addresses) {
let { identities, lostIdentities } = this.store.getState()
+
+ let newlyLost = {}
Object.keys(identities).forEach((identity) => {
if (!addresses.includes(identity)) {
delete identities[identity]
- lostIdentities[identity] = identities[identity]
+ newlyLost[identity] = identities[identity]
}
})
// Identities are no longer present.
- if (Object.keys(lostIdentities).length > 0) {
+ if (Object.keys(newlyLost).length > 0) {
// timeout to prevent blocking the thread:
setTimeout(() => {
@@ -130,6 +132,10 @@ class PreferencesController {
const uri = 'https://diagnostics.metamask.io/v1/orphanedAccounts'
notifier.notify(uri, { accounts: Object.keys(lostIdentities) })
.catch(log.error)
+
+ for (let key in newlyLost) {
+ lostIdentities[key] = newlyLost[key]
+ }
}
this.store.updateState({ identities, lostIdentities })