Skip to content

Commit

Permalink
fix: network tabs handle unsupported chain (#10567)
Browse files Browse the repository at this point in the history
* fix: network tabs handle unsupported chain

* fix: network tabs handle unsupported chain
  • Loading branch information
zhouhanseng committed Aug 22, 2023
1 parent 228c1ea commit 3843b02
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions packages/shared/src/UI/components/NetworkTab/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ import { TabContext } from '@mui/lab'
import { Stack, Tab, Typography } from '@mui/material'
import { WalletIcon } from '../WalletIcon/index.js'
import { SmartPayBundler } from '@masknet/web3-providers'
import { ChainId } from '@masknet/web3-shared-evm'

interface NetworkTabProps {
chains: Web3Helper.ChainIdAll[]
Expand Down Expand Up @@ -56,6 +57,8 @@ export const NetworkTab = memo(function NetworkTab({
if (isValidChainId && chainId && prev !== chainId?.toString()) return chainId.toString()
return prev
})

if (!isValidChainId) setChainId(ChainId.Mainnet)
}, [chainId, isValidChainId])

return (
Expand Down

0 comments on commit 3843b02

Please sign in to comment.