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

[Bugfix | No Issue] Add useEffect for when wallet is connected to different network #2642

Merged
merged 3 commits into from
Dec 19, 2024

Conversation

Da-Colon
Copy link
Contributor

@Da-Colon Da-Colon commented Dec 18, 2024

Noticed that the wallet wouldn't switch to ethereum on page load and that switching networks via the selection wasn't causing hte network to change

@Da-Colon Da-Colon self-assigned this Dec 18, 2024
Copy link

netlify bot commented Dec 18, 2024

Deploy Preview for decent-interface-dev ready!

Name Link
🔨 Latest commit a0773eb
🔍 Latest deploy log https://app.netlify.com/sites/decent-interface-dev/deploys/676438220d55570008f26332
😎 Deploy Preview https://deploy-preview-2642.app.dev.decentdao.org
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

Copy link
Member

@adamgall adamgall left a comment

Choose a reason for hiding this comment

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

@Da-Colon do we need/want a dependency array for this useEffect?

Copy link
Member

@adamgall adamgall left a comment

Choose a reason for hiding this comment

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

Works well for me, thanks @Da-Colon !

@adamgall adamgall merged commit 327c957 into develop Dec 19, 2024
7 checks passed
@adamgall adamgall deleted the bugfix-create-dao-networkswitcher-not-working branch December 19, 2024 15:48
@@ -113,7 +113,7 @@ export function EstablishEssentials(props: ICreationStepProps) {
const chainId = getChainIdFromPrefix(addressPrefix);
switchChain({ chainId });
}
});
}, [chain.id, walletChainID, addressPrefix, switchChain]);
Copy link
Contributor

@DarksightKellar DarksightKellar Dec 19, 2024

Choose a reason for hiding this comment

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

@Da-Colon With these deps, I'm worried about what might happen if the user switches their wallet network themselves, resulting in walletChainID being different from chain.id (right?), and triggering a call to switchChain to chainId from unchanged addressPrefix

@adamgall adamgall mentioned this pull request Dec 19, 2024
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.

3 participants