aleph-im / front-aleph-cloud-page

1 stars 0 forks source link

Fix: Switching network inconsistencies #82

Closed ricardocr987 closed 8 months ago

ricardocr987 commented 8 months ago

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 commented 8 months ago

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