Skip to content

Commit

Permalink
fix: prevent chainType change for unsupported chain
Browse files Browse the repository at this point in the history
  • Loading branch information
Jeday committed Nov 6, 2024
1 parent 6588293 commit 9cbc025
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion modules/web3/web3-provider/dapp-chain.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ export const SupportL2Chains: React.FC<React.PropsWithChildren> = ({
);

useEffect(() => {
if (!walletChainId) {
if (!walletChainId || !config.supportedChains.includes(walletChainId)) {
// This code resets 'chainType' to ETH when the wallet is disconnected.
// It also works on the first rendering, but we don't care, because the 'chainType' by default is ETH.
// Don't use it if you need to do something strictly, only when the wallet is disconnected.
Expand Down

0 comments on commit 9cbc025

Please sign in to comment.