Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[bug] Disconnection feature not working properly #909

Closed
1 task done
gilles-hemmerle opened this issue Dec 12, 2022 · 2 comments
Closed
1 task done

[bug] Disconnection feature not working properly #909

gilles-hemmerle opened this issue Dec 12, 2022 · 2 comments

Comments

@gilles-hemmerle
Copy link

Is there an existing issue for this?

  • I have searched the existing issues

RainbowKit Version

0.7.4

wagmi Version

0.6.8

Current Behavior

When connecting a metamask wallet through the chrome extension, the rainbow kit propose a Disconnect modal when clicking on the Connect button. Disconnection work as expected.

The issue is that if we refresh the browser, the previous wallet is connected again.

Expected Behavior

Two options:

  • Tell the user that disconnection feature is not available for metamask browser extension and it should be handled directly through the metamask extension
  • Find a way to simulate the disconnected state when "disconnect" feature is used in rainbowkit. so the user does not see his previous wallet connected when refreshing the browser

Steps To Reproduce

  • Initialize the rainbowkit extension
  • Create a Connection button
<ConnectButton.Custom>
  {({
    account,
    chain,
    openAccountModal,
    openChainModal,
    openConnectModal,
    mounted,
  }) => {
    return (
      <div
        className="wallet-button-wallet"
        {...(!mounted && {
          'aria-hidden': true,
          style: {
            opacity: 0,
            pointerEvents: 'none',
            userSelect: 'none',
          },
        })}
      >
        {(() => {
          if (!mounted || !account || !chain) {
            return (
              <Button
                variant="outline-primary"
                onClick={openConnectModal}
                type="button"
              >
                Connect Wallet
              </Button>
            );
          }

          if (chain.unsupported) {
            return (
              <Button variant="danger" onClick={openChainModal} type="button">
                Wrong network
              </Button>
            );
          }

          return (
            <div style={{ display: 'flex', gap: 12 }}>
              <Button variant="primary" onClick={openAccountModal} type="button">
                <img src={avatar} className="me-1" alt="Avatar" />
                {account.displayName}
              </Button>
            </div>
          );
        })()}
      </div>
    );
  }}
</ConnectButton.Custom>
  • Connect a metamask wallet through browser extension
  • Use the disconnect button

image

  • The wallet is disconnected
  • Refresh the browser one or two times: The wallet is automatically reconnected

Link to Minimal Reproducible Example (CodeSandbox, StackBlitz, etc.)

https://d2cdkz.csb.app/

Anything else?

No response

@dalechyn
Copy link
Contributor

#807

@DanielSinclair
Copy link
Collaborator

Closing in favor of the discussion in #807

@DanielSinclair DanielSinclair closed this as not planned Won't fix, can't repro, duplicate, stale Feb 8, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants