When using the connectTo function, there is a delay when closing the modal and calling the connectTo function again, why is there such a delay and can we mitigate it? If we can’t I might display a loader but it impact UX.
Thanks for reaching out. It sounds like you’re experiencing a delay when closing the modal and calling the connectTo function again using the Web3Auth PnP Web SDK.
Issue: Delay when closing the modal and re-calling connectTo
To further assist you, could you share:
Your Web3Auth Initialization & Login Code Snippets? This will help us understand the setup and potentially identify any issues.
Browser Console Screenshots you have when the delay happens? This can give insight into any warnings or errors logged.
Additionally, you’ve mentioned considering a loader to mitigate the UX impact. The development team can review your setup and see if there’s a more seamless solution.
I’ll flag this for the team, and they’ll follow up shortly with a detailed response.
This response was generated by the Web3Auth Bot, and a member from the Web3Auth team will provide further assistance.
Thanks for your response but this wan’t the problem. I know I can’t make the button does nothing while the web3auth is not ready. My concern is more about the long time it takes for the web3auth to be ready… It tooks 12 seconds during my tests for web3auth to be ready again. Speaking about UX it’s bad
I updated the package so you can test it yourself and tell me if you have 12 seconds as well
The delay you’re seeing is due to Facebook and LINE logins. Both set Cross-Origin-Opener-Policy to same-origin, meaning we can’t immediately detect if the popup is closed. Web3Auth waits around 10 seconds to see if the login completes, which is why there’s a “locked out” period before it transitions from connecting to errored.
Unfortunately, due to these restrictions, there’s no direct way to shorten this timeout. You could show a loader during the delay to help improve the UX.
The 10-second timeout is in place because Web3Auth supports logins with providers like Facebook and LINE. As explained above as well, both of these set Cross-Origin-Opener-Policy to same-origin, meaning we can’t immediately detect when the popup is closed. For these providers, Web3Auth waits up to 10 seconds to check if the login can be completed, which is why this timeout is necessary.
Reducing this timeout for Google could cause issues for users logging in via Facebook or LINE, which is why it’s currently HARDCODED for consistency across providers. I hope that clears it up.