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

Fix: wrong connector after page reload #105

Merged
merged 2 commits into from
Dec 6, 2023

Conversation

alx-khramov
Copy link
Contributor

@alx-khramov alx-khramov commented Nov 24, 2023

Resolves SI-954

We have several Wallet Adapters. Each Wallet Adapter uses its own instance of InjectedConnector.

  1. Autoconnect by wagmi checks last used connector first: here
  2. Last used connector is stored in localstorage like this and is being set here using connector's id
  3. The problem is that all InjectedConnectors have the id === 'injected' property: see here
  4. During autoconnect, there is a sorting of connectors wallet, which makes a last used connector (with injected id in this case) to be the first: here. Since we have several connectors with injected id, we get the wrong connector here.

This PR wraps injected connectors for injected wallets in custom connectors with different connector IDs.

@alx-khramov alx-khramov self-assigned this Nov 24, 2023
@alx-khramov alx-khramov requested a review from a team as a code owner November 24, 2023 13:49
Copy link

changeset-bot bot commented Nov 24, 2023

⚠️ No Changeset found

Latest commit: d7e0060

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

Tarens2
Tarens2 previously approved these changes Nov 24, 2023
@alx-khramov alx-khramov force-pushed the fix/wrong-connector-after-reload branch from cb71296 to d7e0060 Compare November 27, 2023 12:35
Copy link

@solidovic solidovic left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm

@alx-khramov alx-khramov merged commit e6cbbab into main Dec 6, 2023
1 check passed
@alx-khramov alx-khramov deleted the fix/wrong-connector-after-reload branch December 6, 2023 11:28
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

Successfully merging this pull request may close these issues.

5 participants