blocknative / web3-onboard

Client library to onboard users to web3 apps
https://onboard.blocknative.com/
MIT License
813 stars 474 forks source link

connect({}) throws runtime error, yet compiles according to type system #2237

Closed bengobeil closed 2 weeks ago

bengobeil commented 2 weeks ago

Current Behavior

After upgrading to current version of web3onboard/react, my code fails due to connect({})

Expected Behavior

should not fail since ConnectOptions allows for undefined autoSelect. Getting autoSelect is undefined in index.svelte.

Steps To Reproduce

Call the connect function with {}

What package is effected by this issue?

@web3-onboard/core

Is this a build or a runtime issue?

Runtime

Package Version

2.9.1

Node Version

20.11

What browsers are you seeing the problem on?

Firefox

Relevant log output

TypeError: autoSelect is undefined
    4 Index.svelte:418
    RxJS 14
    instance$4 Index.svelte:415
    init$1 index.mjs:2165
    Index$1 index.2d3ace14.js:216334
    create_if_block_20 index.2d3ace14.js:216795
    p index.2d3ace14.js:218159
    update index.mjs:1347
    flush index.mjs:1307
    promise callback*schedule_update index.mjs:1258
    make_dirty index.mjs:2133
    ctx index.mjs:2171
    instance index.2d3ace14.js:218324
    RxJS 26
    dispatch$1 index.ts:117
    setWalletModules actions.ts:216
    connect$1 connect.ts:30
    connect useConnectWallet.js:12
    walletSelect useWeb3.tsx:165
    React 23
    ["4aBH6"]< index.tsx:95
    newRequire index.2d3ace14.js:71
    <anonymous> index.2d3ace14.js:122
    <anonymous> index.2d3ace14.js:145

Uncaught (in promise) TypeError: ctx[0] is undefined
    create_fragment$4 Index.svelte:580
    init$1 index.mjs:2180
    Index$1 index.2d3ace14.js:216334
    create_if_block_20 index.2d3ace14.js:216795
    p index.2d3ace14.js:218159
    update index.mjs:1347
    flush index.mjs:1307
    promise callback*schedule_update index.mjs:1258
    make_dirty index.mjs:2133
    ctx index.mjs:2171
    instance index.2d3ace14.js:218324
    RxJS 26
    dispatch$1 index.ts:117
    setWalletModules actions.ts:216
    connect$1 connect.ts:30
    connect useConnectWallet.js:12
    walletSelect useWeb3.tsx:165
    React 23
    ["4aBH6"]< index.tsx:95
    newRequire index.2d3ace14.js:71
    <anonymous> index.2d3ace14.js:122
    <anonymous> index.2d3ace14.js:145
Index.svelte:580:6

Anything else?

No response

Sanity Check

Adamj1232 commented 2 weeks ago

@bengobeil please give this a shot with @web3-onboard/react v 2.9.2-alpha.2 should be fixed but would love confirmation on your end prior to release

bengobeil commented 2 weeks ago

yes @Adamj1232 it works, thanks!