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

Disconnected session cookie not removed after connecting again #4097

Open
1 task done
dengpeng opened this issue Jun 28, 2024 · 1 comment
Open
1 task done

Disconnected session cookie not removed after connecting again #4097

dengpeng opened this issue Jun 28, 2024 · 1 comment
Labels
Good First Issue Misc: Good First Issue

Comments

@dengpeng
Copy link

Check existing issues

Describe the bug

When calling disconnect, wagmi would normally store a session cookie like wagmi.io.metamask.disconnected so the page stays disconnected after a refresh.

However, this cookie should be cleared/removed if the user connects again. This removal of the "disconnected" cookie currently only works when the the "connect" call is made on the root / and first level pages (e.g. /foo) but NOT on pages that are deeper (e.g. /bar/qux or /a/b/c).

Link to Minimal Reproducible Example

https://wagmi-bug.vercel.app/

Steps To Reproduce

(Code is available at https://github.com/dengpeng/wagmi-bug)

  • Correct behavior:

    1. Go to https://wagmi-bug.vercel.app/ or https://wagmi-bug.vercel.app/foo.
    2. Connect wallet then disconnect wallet
    3. Now a session cookie wagmi.io.metamask.disconnected is set.
    4. After a successful connect on that page once again, the cookie wagmi.io.metamask.disconnected is removed. ✅
  • Incorrect behavior:

    1. Go to https://wagmi-bug.vercel.app/bar/qux or https://wagmi-bug.vercel.app/a/b/c
    2. Connect wallet then disconnect wallet
    3. Now a session cookie wagmi.io.metamask.disconnected is set.
    4. After a successful connect on that page once again, the cookie wagmi.io.metamask.disconnected is NOT removed. ❌
    5. This will lead to wallet not automatically re-connecting after the page is reloaded. ⚠️

What Wagmi package(s) are you using?

wagmi, @wagmi/core

Wagmi Version

@wagmi/[email protected], [email protected]

Viem Version

2.16.3

TypeScript Version

5

Anything else?

No response

@arunkumar201
Copy link

yeah same issue

#4073

@tmm tmm added the Good First Issue Misc: Good First Issue label Jul 1, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Good First Issue Misc: Good First Issue
Projects
None yet
Development

No branches or pull requests

3 participants