diff options
author | Paul Bouchon <mail@bitpshr.net> | 2018-11-18 20:23:04 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-11-18 20:23:04 +0800 |
commit | 7fe37276a17cbbcb566a0650603eb5ed6115179b (patch) | |
tree | 4e97d10e98a6a2bfa3e70bb76b45fd977beb9bde | |
parent | fdea642e6d5b23d4573759e4f1a1f4016557c0be (diff) | |
download | tangerine-wallet-browser-7fe37276a17cbbcb566a0650603eb5ed6115179b.tar.gz tangerine-wallet-browser-7fe37276a17cbbcb566a0650603eb5ed6115179b.tar.zst tangerine-wallet-browser-7fe37276a17cbbcb566a0650603eb5ed6115179b.zip |
1102: Push publicConfigStore to next turn to avoid race conditiono (#5777)
-rw-r--r-- | app/scripts/inpage.js | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/app/scripts/inpage.js b/app/scripts/inpage.js index 08d78e8ab..f8c6cf573 100644 --- a/app/scripts/inpage.js +++ b/app/scripts/inpage.js @@ -59,7 +59,9 @@ onMessage('metamasksetlocked', () => { isEnabled = false }) // set up a listener for privacy mode responses onMessage('ethereumproviderlegacy', ({ data: { selectedAddress } }) => { isEnabled = true - inpageProvider.publicConfigStore.updateState({ selectedAddress }) + setTimeout(() => { + inpageProvider.publicConfigStore.updateState({ selectedAddress }) + }, 0) }, true) // augment the provider with its enable method @@ -70,7 +72,9 @@ inpageProvider.enable = function ({ force } = {}) { reject(error) } else { window.removeEventListener('message', providerHandle) - inpageProvider.publicConfigStore.updateState({ selectedAddress }) + setTimeout(() => { + inpageProvider.publicConfigStore.updateState({ selectedAddress }) + }, 0) // wait for the background to update with an account inpageProvider.sendAsync({ method: 'eth_accounts', params: [] }, (error, response) => { |