No-modal sdk delay when closing the popup

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.

Anyone having the same issue?

  • SDK Version(package.json): @web3auth/no-modal": “^8.12.4”,
  • Platform: web / react

delay_web3auth_gif

Error: WalletInitializationError: Wallet is not ready yet, Already connecting

Hi Silhol,

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.

You’ve provided:

  • SDK Version: @web3auth/no-modal “^8.12.4”
  • Platform: Web / React
  • Issue: Delay when closing the modal and re-calling connectTo

To further assist you, could you share:

  1. Your Web3Auth Initialization & Login Code Snippets? This will help us understand the setup and potentially identify any issues.
  2. 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.

Hey @bastien
Welcome aboard! Can you please share your Web3Auth implementation?

Hello here is the minimal reproductible bug and a video of what’s happening

ezgif-7-41959c2280

Hello were you able to reproduce it?

I fixed the issues with the code and raised a PR. Please try and let me know if you are still facing these issues: Fixed WC and login issues by ihsraham · Pull Request #1 · real-token/web3auth-bugreport · GitHub

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

ezgif-4-b56d3ef91c

Regards

Hey @Bastien,

Thanks for the updated code. Here’s how it’s been working for me: Screen Recording 2024-10-14 at 17.18.03.mov [video-to-gif output image]

By any chance, are you using a VPN or proxies that might be delaying the calls? It could also be an issue with your ISP.

Maybe your gif has an issue but I don’t see you clicking the login button, can you do this sequence for me:

Click login → Close the google popup ASAP → wait until web3auth is ready

And show me the gif please

Regards,
Bastien

Hey @Bastien,

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.

Screen Recording 2024-10-15 at 16.55.53.mov [video-to-gif output image]

The delay we see there is due to the regular 10 seconds timeout which is HARDCODED why can’t we reduce this delay, to 1 second Auth/src/core/utils.ts at 19931a7d5fd3b782a7db90821f3c1fcd10a364ef · Web3Auth/Auth · GitHub
I’m going to open a PR to this package

I have made a change in the @web3auth/auth package now it’s working better, you can try it yourself here

ezgif-1-e5c9a9bd9f

made a github issue here delay when closing nomodal sdk popup · Issue #345 · Web3Auth/Auth · GitHub