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: only switch chain when in focus #32

Merged
merged 1 commit into from
Sep 13, 2021

Conversation

saurfang
Copy link
Contributor

With the current auto chain switch logic, it is disruptive when users have multiple dapps open across different chains. Add a hook to check whether window is in focus and only prompt to chain network when it is in focus.

Also, fix a bug where supportedChainIds was set to a narrow set. This made the page swallow error when connecting wallet from an unknown network. Now that we have chain switch code, we can accept any network and prompt user to switch after wallet is injected.
To reproduce this error, start the dapp with an unsupported network, e.g. polygon, and users do not get prompt to change network.

@vercel
Copy link

vercel bot commented Sep 13, 2021

This pull request is being automatically deployed with Vercel (learn more).
To see the status of your deployment, click below or on the icon next to each commit.

🔍 Inspect: https://vercel.com/tbouder/rarity/963BLW5KcpfVHzscNnqDQE3T8xwP
✅ Preview: https://rarity-git-fork-saurfang-fix-switchchainonfocus-tbouder.vercel.app

@@ -0,0 +1,28 @@
/******************************************************************************
** @Author: Rarity Extended
** @Twitter: @MajorTom_eth
Copy link
Contributor

Choose a reason for hiding this comment

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

You may want to change that if you want :)

Copy link
Contributor

@TBouder TBouder left a comment

Choose a reason for hiding this comment

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

LGTM, will wait for @fameal approval too!

Copy link
Collaborator

@saltyfacu saltyfacu left a comment

Choose a reason for hiding this comment

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

It's working well. Really nice improvement.

@TBouder TBouder changed the base branch from develop to main September 13, 2021 13:09
@saltyfacu saltyfacu merged commit a22164e into Rarity-Extended:main Sep 13, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants