useDApp icon indicating copy to clipboard operation
useDApp copied to clipboard

Warning: Suppressed stale connector activation [object Object]

Open Philogy opened this issue 4 years ago • 3 comments

I get this warning in the console when trying to connect to metamask in my react (next.js) app using activateBrowserWallet indirectly. The way I'm doing this is via a custom hook I made which provides me with a function which calls activateBrowserWallet in the background but which also keeps track of the current state of the connection. While this is only a warning the account prop returned by the useEthers hook doesn't seem to be updated without directly refreshing the page despite metamask being connected to the page.

My current work-around is directly using await window.ethereum.request({ method: 'eth_requestAccounts' }) and then immediately after calling activateBrowserWallet(). Let me know if you have any ideas on fixes or additional information you'd like me to provide.

Philogy avatar Sep 27 '21 11:09 Philogy

I've got the same issue, while the warning doesn't bother me, it's a bit annoying having to refresh the webpage in order for account to be non-null after calling activateBrowserWallet.

georgeroman avatar Oct 02 '21 15:10 georgeroman

I'm also encountering this.

josh-richardson avatar Oct 10 '21 14:10 josh-richardson

I have tried to reproduce on current version of useDApp - 1.1.5.

I tried to do something like:

<DAppProvider config={config}>
    <IndirectActivator />
    <App />
</DAppProvider>
function App () {
  // Main page, that displays the `account` from `useEthers`
}

function IndirectActivator () {
  const { activateBrowserWallet } = useEthers()

  // Activate browser wallet indirectly in a different component than the main one.
  useEffect(() => {
    setTimeout(() => {
      activateBrowserWallet()
    }, 2000)
  }, [])
}

It seems like account is non-null without refreshing the page.

@Philogy @georgeroman @josh-richardson Do you have any more pointers on reproducing this? Or maybe the issue is resolved in a recent version?

rzadp avatar Aug 23 '22 12:08 rzadp