Skip to content

[Bug]: await connectWallet with autoSelect and disableModals will stuck forever if the injected provider is not found #1153

@mayone

Description

@mayone

Current Behavior

Using await onboard.connectWallet() with autoSelect and disableModals seems to be the only way to connect all the previously connected wallets.
I followed the instruction here https://docs.blocknative.com/onboard/core#auto-selecting-a-wallet

for (const walletLabel of prevConnectedWallets.reverse()) {
    await onboard.connectWallet({
        autoSelect: {
            label: walletLabel,
            disableModals: true,
        },
    });
}

But if one of the wallet extension is closed or crashed, the autoSelect will fail (to look up for the injected provider) and the connectWallet will stuck there without returning anything (since disableModals)

Expected Behavior

The await connectWallet with autoSelect and disableModals should return when the auto select failed (maybe injected provider not found) instead of hanging there.
Since the modal is disabled, the behavior should be different in my opinion.

Steps To Reproduce

Easy way to reproduce

  • Connect to a none existed wallet
  • Instead of returning error, it will stuck there
await onboard.connectWallet({
    autoSelect: {
        label: 'Wallet not found',
        disableModals: true,
    },
 });

Practical case

  • Connect to a closed wallet extension
  • Instead of returning error, it will stuck there
await onboard.connectWallet({
    autoSelect: {
        label: 'MetaMask',
        disableModals: true,
    },
 });

What package is effected by this issue?

@web3-onboard/core

Is this a build or a runtime issue?

Runtime

Package Version

2.5.0

Node Version

18.6.0

What browsers are you seeing the problem on?

Chrome

Relevant log output

No response

Anything else?

No response

Sanity Check

  • If this is a build issue, I have included my build config. If this is a runtime issue, I have included reproduction steps and/or a Minimal, Reproducible Example.

Metadata

Metadata

Labels

bugSomething isn't working

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions