Commit fd0489e6 authored by Clayton Lin's avatar Clayton Lin Committed by GitHub

feat: Suppress the account modal after connect (#3848)

fix: Suppress the account modal after connect
parent caa0a296
...@@ -127,7 +127,7 @@ export default function WalletModal({ ...@@ -127,7 +127,7 @@ export default function WalletModal({
ENSName?: string ENSName?: string
}) { }) {
// important that these are destructed from the account-specific web3-react context // important that these are destructed from the account-specific web3-react context
const { active, account, connector, activate, error } = useWeb3React() const { account, connector, activate, error } = useWeb3React()
const [walletView, setWalletView] = useState(WALLET_VIEWS.ACCOUNT) const [walletView, setWalletView] = useState(WALLET_VIEWS.ACCOUNT)
const previousWalletView = usePrevious(walletView) const previousWalletView = usePrevious(walletView)
...@@ -161,13 +161,6 @@ export default function WalletModal({ ...@@ -161,13 +161,6 @@ export default function WalletModal({
}, [walletModalOpen, resetAccountView]) }, [walletModalOpen, resetAccountView])
// close modal when a connection is successful // close modal when a connection is successful
const activePrevious = usePrevious(active)
const connectorPrevious = usePrevious(connector)
useEffect(() => {
if (walletModalOpen && ((active && !activePrevious) || (connector && connector !== connectorPrevious && !error))) {
setWalletView(WALLET_VIEWS.ACCOUNT)
}
}, [setWalletView, active, error, connector, walletModalOpen, activePrevious, connectorPrevious])
const tryActivation = async (connector: AbstractConnector | undefined) => { const tryActivation = async (connector: AbstractConnector | undefined) => {
let name = '' let name = ''
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment