Describe the bug
Requesting accounts and then chaining another action, like personal_sign, the popup does not appear if there is a delay. Furthermore, after completing the action, signing the message, a loading spinner stays on indefinitely. And furthermore still, if you request the same action (personal sign) again, it will open in a popup, but the popup will not close afterward.
To Reproduce (REQUIRED)
Steps to reproduce the behavior, libraries used with version number, and/or any setup information to easily reproduce:
window.ethereum.request({method:'eth_requestAccounts'})
// setTimeout will play the part of an AJAX "getMessageToSign" here.
.then(acc => new Promise(r =>
setTimeout(() => r(acc)
, 200
)
))
.then(acc => window.ethereum.request({ method: 'personal_sign', params: ['hello', acc[0]], from: acc[0]}))
.then(console.info)
The duration of the timeout matters, but happens to me every time with 200ms.
Expected behavior
The action request should pop up, and no loading spinner should stay in sight.
Browser details (please complete the following information):
Thanks for the report, and the example! I was able to reproduce this.
if you request the same action (personal sign) again, it will open in a popup, but the popup will not close afterward.
To add to this: the loading screen upon signing is never dismissed. This is why the popup doesn't close; because it doesn't know the signing has finished. The same thing happens if you open the popup UI by clicking on MetaMask in the toolbar: it gets stuck loading after you click 'Sign'.
Just discovered this behavior as well and sent in a Support Ticket 馃檮, then thought better and came here to open. So... sorry to your support ticket people!
This seems to be a combination of two distinct issues:
personal_sign request, the loading overlay never goes away.The second problem has been fixed in #9006, but I'm still working on the first problem.
This is still happening when I
Except that the loading spinner doesn't stay on, that is fixed. It's just that the popup goes away and never comes back.
~@losnappas In that situation, if you're already "connected", why would you expect the popup to stay open? It's closed in that case because there is nothing further for the user to confirm.~
I would expect the popup to either stay open or reopen, so I can sign the message. Currently the popup closes, and the signature request shows up on the browser action button label, but nothing else shows up.
@losnappas Whoops, I misunderstood the scenario you were talking about, my apologies.
After trying again, I can't seem to reproduce the problem you describe. When I test it on Chrome using v8.0.5, an initial popup appears at first for the unlock prompt, then a second popup appears for the signature request.
No worries. I am on Firefox 78.0.2 with MM version 8.0.5.
Let me go through the steps, to make sure we're doing the same thing:
I just noticed that I had a couple of tries where the bug did not occur, but it does more reliably occur when you increase the timeout from 200ms to 500ms.
Thanks for the further instructions! I have attempted to reproduce this using Firefox 78.0.2 and MetaMask v8.0.5 on Ubuntu using the steps described, and I was still unable. Even after changing the timeout to 500ms and testing 10 times, it worked every time.
It's possible that it's a race condition that is more likely under certain conditions though (e.g. faster/slower CPU), so I'll take a quick look to see if I can guess how this could happen. Please let me know if you can think of a way to more consistently reproduce this though.
I think you want to try and match the timeout and the popup closing time. So after you hit "unlock" the loading spinner goes around for a bit before the popup closes, and right as it does, that's when you'd request the signature.
Ah, that did it! I was able to reproduce this by reducing the timeout.
This is happening again...