extension icon indicating copy to clipboard operation
extension copied to clipboard

web3Enable promise stalled on first page load in extension-dapp

Open attemka opened this issue 1 year ago • 1 comments

  • I'm submitting a ...
  • [x] Bug report
  • [ ] Feature request
  • [ ] Support request
  • [ ] Other
  • What is the current behavior and expected behavior?

Current behavior: On first page load (e.g new window of chrome incognito mode) web3Enable function could freeze on it's execution. Expected behavior: URL authorization window popup is shown when web3Enable function is fired. STR:

  1. Create any react project (e.g CRA 5.x.x).
  2. Add the extension connection code:
 const connectWallet = async () => {
    console.log('Web3 Injected: ' + isWeb3Injected)
    const allInjected = await web3Enable('my cool dapp');
    const allAccounts = await web3Accounts();
    console.log(allAccounts)
  }        

And the button which will execute it on click. 4. Open new incognito window in chrome and go to the app page. 5. Click the connection button. You'll see no action, even though it will be "Web3 Injected: true" in the console. 6. Refresh the page and try again. You'll see normal behavior from now on.

Couldn't be reproduced in firefox browser.

  • What is the motivation for changing the behavior?

User should be able to connect the extension even on new incognito window.

Please tell us about your environment:

  • OS: macOS 13.2.1
  • Browser: Chrome 111.0.5563.64 (Official Build) (arm64), new incognito window, all extensions except for polkadot-js are disabled
  • Extension version: 0.44.1
  • Code setup: CRA 5.0.1
  • Version: 0.44.1

  • Environment:

    • [ ] Node.js
    • [x] Browser
    • [ ] Other (limited support for other environments)
  • Language:

    • [x] JavaScript
    • [x] TypeScript v4.9.5
    • [ ] Other

attemka avatar Mar 21 '23 11:03 attemka

Same issue here

niklasp avatar Apr 20 '23 20:04 niklasp