I have encountered an intermittent issue where Dapp incorrectly displays a warning banner stating that the user's crypto wallets are not installed, even though they are. This appears to be due to the Dapp checking for the existence of window.ethereum before the wallet extension has had sufficient time to inject the ethereum object into the window.
Expected Behavior
Should be no banner
Actual Behavior
The Dapp intermittently displays a warning banner about wallets not being installed due to premature checking for window.ethereum, even when a crypto wallet like MetaMask or Rabby is installed.
Description
I have encountered an intermittent issue where Dapp incorrectly displays a warning banner stating that the user's crypto wallets are not installed, even though they are. This appears to be due to the Dapp checking for the existence of
window.ethereum
before the wallet extension has had sufficient time to inject theethereum
object into the window.Expected Behavior
Should be no banner
Actual Behavior
The Dapp intermittently displays a warning banner about wallets not being installed due to premature checking for
window.ethereum
, even when a crypto wallet likeMetaMask
orRabby
is installed.Possible Solution
Сhecking
window.ethereum
with a delayAdditional Information