Skip to content

Auto Select Wallet Disable Modals

Compare
Choose a tag to compare
@lnbc1QWFyb24 lnbc1QWFyb24 released this 10 Mar 00:20
44425b6

This release adds an enhancement to the auto select wallet flow, allowing for an additional option to disable modals which prevents modals from flashing on screen on a successful auto connect.

const previouslySelectedWallet = window.localStorage.getItem('selectedWalletLabel')

onboard.connectWallet({
  autoSelect: {
    label: previouslyConnectedWallet,
    disableModals: true
  }
})

The original way of calling connectWallet with the autoselect parameter as a string is also still valid and will get converted to the new options object internally.

There are edge cases where a user may have disabled, logged out or revoked access to your app since last session, in which case the usual wallet popups will fire, but no Onboard modals will display and the call to connect wallet may not resolve if the user does not successfully log in.

Changelog:

  • web3-onboard/core:v2.0.9: [enhancement] - Autoselect Disable Modals (#873)