Skip to content
This repository has been archived by the owner on Nov 10, 2023. It is now read-only.

fix: remove provider on disconnect #3939

Merged
merged 3 commits into from
Jun 9, 2022
Merged

fix: remove provider on disconnect #3939

merged 3 commits into from
Jun 9, 2022

Conversation

iamacook
Copy link
Member

@iamacook iamacook commented Jun 8, 2022

What it solves

Resolves #3938

How this PR fixes it

Removal of the last provider cache occurs with clicking disconnect.

It was previously removed when onboard was totally disconnected and the provider store was empty, which occurs when switching chain. We didn't experience this bug before as the removal of the wrong key was attempted.

How to test it

Connect a wallet and:

  1. switch to a supported chain and observe successful reconnection.
  2. switch to an unsupported chain and observe no reconnection. Switching back to a supported chain should successfully reconnect,

@iamacook iamacook requested a review from katspaugh June 8, 2022 12:20
@iamacook iamacook marked this pull request as ready for review June 8, 2022 12:20
@github-actions
Copy link

github-actions bot commented Jun 8, 2022

CLA Assistant Lite All Contributors have signed the CLA.

@github-actions
Copy link

github-actions bot commented Jun 8, 2022

ESLint Summary View Full Report

Annotations are provided inline on the Files Changed tab. You can also see all annotations that were generated on the annotations page.

Type Occurrences Fixable
Errors 0 0
Warnings 0 0
Ignored 0 N/A
  • Result: ✅ success
  • Annotations: 0 total

Report generated by eslint-plus-action

@katspaugh
Copy link
Member

What if you disconnect from the wallet itself?

Doesn't onboard have a specific disconnect event?

@github-actions
Copy link

github-actions bot commented Jun 8, 2022

Deployment links

Mainnet     🟣 Polygon     🟠 Rinkeby

@coveralls
Copy link

coveralls commented Jun 8, 2022

Pull Request Test Coverage Report for Build 2462374324

  • 0 of 1 (0.0%) changed or added relevant line in 1 file are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage remained the same at 36.621%

Changes Missing Coverage Covered Lines Changed/Added Lines %
src/components/AppLayout/Header/index.tsx 0 1 0.0%
Totals Coverage Status
Change from base Build 2461049552: 0.0%
Covered Lines: 3847
Relevant Lines: 9545

💛 - Coveralls

@iamacook iamacook marked this pull request as draft June 8, 2022 13:15
@iamacook
Copy link
Member Author

iamacook commented Jun 8, 2022

What if you disconnect from the wallet itself?

Doesn't onboard have a specific disconnect event?

Sadly it doesn't. I think it's current implementation flows better than before though.

@iamacook iamacook marked this pull request as ready for review June 8, 2022 14:54
@iamacook iamacook requested a review from usame-algan June 8, 2022 14:54
Copy link
Member

@usame-algan usame-algan left a comment

Choose a reason for hiding this comment

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

🚀

Copy link
Member

@katspaugh katspaugh left a comment

Choose a reason for hiding this comment

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

Thanks!

@francovenica
Copy link
Contributor

For what I see It only works with MM. Is this how is expected to work?

I tried WC, Trezor and Ledger and those do not keep the connection, for example going from rinkeby to mainnet since both networks support all the wallets mentioned.
If WC, Trezor and Ledger don't allow this "re connection" between networks let me know and we can ignore it for this ticket

@iamacook
Copy link
Member Author

iamacook commented Jun 9, 2022

I tried WC, Trezor and Ledger and those do not keep the connection, for example going from rinkeby to mainnet since both networks support all the wallets mentioned. If WC, Trezor and Ledger don't allow this "re connection" between networks let me know and we can ignore it for this ticket

I'm pretty sure you're correct. WC sessions are chain specific and hardware wallets do not allow for switching networks.

@katspaugh
Copy link
Member

WC sessions are chain specific

This might be true in our case, but most other apps allow switching the chain within a single WC session.

@iamacook
Copy link
Member Author

iamacook commented Jun 9, 2022

This might be true in our case, but most other apps allow switching the chain within a single WC session.

Switching via the wallet is supported and prod/this PR does this:

Changing network via wallet (maintains connection):

This PR:
Switch network via WC on PR

Prod.:
Switch network via WC on prod

Changing network via Safe (does not reconnect):

PR:
Switch in UI on PR

Prod.:
Switch in UI on prod

WC doesn't support the wallet_switchEthereumChain method, so it's not possible via the Safe.

@iamacook iamacook merged commit 4952348 into dev Jun 9, 2022
@iamacook iamacook deleted the wallet-disconnection branch June 9, 2022 07:27
@github-actions github-actions bot locked and limited conversation to collaborators Jun 9, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

The wallet is disconnected on the network switching
5 participants