question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Question: best way to determine if the modal will/will not appear?

See original GitHub issue

Sorry if there’s a more appropriate place to ask this question!

I’m trying to develop the following UX on web3Modal:

  1. The user comes to site A for the first time
  2. The user clicks “connect”, sees the web3modal, selects a provider
  3. The user’s provider is cached
  4. The user refreshes the page
  5. The user is “auto-connected”

The docs seemed to point to using the cachedProvider property to determine this, but in some cases, cachedProvider returns true, and the modal still appears.

The problem here is that this ends up resulting in some users refreshing their page, and then the metamask popup immediately opening, which is obviously poor UX.

Issue Analytics

  • State:open
  • Created 3 years ago
  • Comments:5

github_iconTop GitHub Comments

1reaction
Schwartz10commented, Mar 14, 2021

But I’m thinking that maybe you’re not handling the connection when mounting the app again

This is what I thought too initially, but the problem is that calling this.web3Modal.connect() does open the model sometimes, even when cachedProvider is true. The result is that a user coming to the site will immediately see the popup on page load, which is an unintended behavior.

What i’m specifically looking for is something like:

if (!web3Modal.willToggleOpenOnConnect) {
       web3Modal.connect()
  } else {
      // do nothing because we do not want modal to appear
   }

I specifically do not want to call connect inside componentDidMount if the modal will open - when cachedProvider is true, sometimes the modal still opens.

Thank you again for your help on this specific question.

0reactions
sawirricardocommented, Oct 30, 2021

@Schwartz10 How did you end up doing it? I am facing this too right now

Read more comments on GitHub >

github_iconTop Results From Across the Web

Can I check if Bootstrap Modal Shown / Hidden?
The best method is given in the docs $('#myModal').on('shown.bs.modal', function () { // will only come inside after the modal is shown });....
Read more >
No more mistakes with MODALS! 3 Easy Rules - YouTube
In this lesson you' ll learn how to use modal verbs properly, and how to avoid ... Right ? Okay. So, let's look...
Read more >
English Grammar: How to Use “will”
Grammar rules "Will" and the negative form "will not" or "won't" is a modal auxiliary verb. This means that there is no s...
Read more >
Modals - UNC Writing Center
Modal verbs (will, would, should, may, can, could, might, must) precede another verb. Modals do not have subject-verb agreement or take the infinitive...
Read more >
Grammar: Modal Verbs – Coalescence
First, modal verbs add meaning to another verb. You don't usually use a modal verb by itself unless the main verb is implied...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found