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: Switching network inconsistencies #82

Merged
merged 3 commits into from
Feb 12, 2024
Merged

Conversation

ricardocr987
Copy link
Contributor

The issue was related to how the connect function handled error cases. Previously, all errors were assumed to be network switching cases, but the caught error was actually due to multiple calls to this function (not yet resolved, with the specific error 'wallet_addEthereumChain already pending'). For now, this error is being bypassed.

image

Changes:

Moved the network switching functionality into a specific function, rather than handling it in the connect function's catch block.

Related:

It's unclear to me how the WalletPicker component shares the state of the selected network with the app. It seems that this state is isolated. WalletPicker Component
The handleConnect function is called without a network argument, leading to an undefined state at the end of the call tree. handleConnect Function

@MHHukiewitz
Copy link
Member

LGTM, but do run npm run lint:fix and npm run build to see if you get any build errors. Also:

./src/hooks/pages/useHeader.ts
204:26  Warning: Unexpected any. Specify a different type.  @typescript-eslint/no-explicit-any
216:28  Warning: Unexpected any. Specify a different type.  @typescript-eslint/no-explicit-any
220:6  Warning: React Hook useEffect has missing dependencies: 'connect' and 'provider'. Either include them or remove the dependency array.  react-hooks/exhaustive-deps

@MHHukiewitz MHHukiewitz marked this pull request as ready for review February 12, 2024 14:51
Copy link
Member

@MHHukiewitz MHHukiewitz left a comment

Choose a reason for hiding this comment

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

LGTM

@MHHukiewitz MHHukiewitz merged commit d17e03f into main Feb 12, 2024
1 check passed
@MHHukiewitz MHHukiewitz deleted the fix-switch-network branch February 12, 2024 14:53
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.

2 participants