1
0
mirror of https://github.com/kremalicious/metamask-extension.git synced 2024-12-23 09:52:26 +01:00

1102: Push publicConfigStore to next turn to avoid race conditiono (#5777)

This commit is contained in:
Paul Bouchon 2018-11-18 07:23:04 -05:00 committed by GitHub
parent fdea642e6d
commit 7fe37276a1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -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) => {