You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
To initialize onboard we need to pass a chainId in order to decide which wallets to enable. This chainId comes from useChainId which in turn gets the chainId from different sources in the following order:
From the url e.g. ?chain=1
From local storage under session.lastChainId depending on the safe that was last opened
From the connected wallet -> This is undefined because a wallet can only be connected once onboard is ready
From the default chain id which is either mainnet (1) or sepolia on dev environments (11155111)
However there are issues in case the user has a chainId stored under session.lastChainId that doesn't exist anymore in the chains config. This can happen if:
Switching between staging and prod config (only an issue for users working in both environments)
Turning off a network (temporarily)
Environment
Browser: Any
Wallet: Any
Chain: Any
Steps to reproduce
Go to app.safe.global and open a safe on a network that is not supported
Observe the chainId of that network is stored in local storage under session.lastChainId
Go to the welcome page
Try to connect your wallet
Expected result
Different options:
Connect button should be disabled
There should be an error that the wallet could not be initialized (e.g. because the network detected can't be found) and an option to "reset" the network
...
Obtained result
Nothing happens
The text was updated successfully, but these errors were encountered:
usame-algan
changed the title
Onboard initialization doesn't work sometimes
Connect wallet doesn't work if stored chain id doesn't exist
Feb 25, 2025
Bug description
To initialize onboard we need to pass a chainId in order to decide which wallets to enable. This chainId comes from
useChainId
which in turn gets the chainId from different sources in the following order:?chain=1
session.lastChainId
depending on the safe that was last openedHowever there are issues in case the user has a chainId stored under
session.lastChainId
that doesn't exist anymore in the chains config. This can happen if:Environment
Steps to reproduce
session.lastChainId
Expected result
Different options:
Obtained result
Nothing happens
The text was updated successfully, but these errors were encountered: