Skip to content
This repository has been archived by the owner on Nov 10, 2023. It is now read-only.

Commit

Permalink
fix: remove provider on disconnect (#3939)
Browse files Browse the repository at this point in the history
* fix: remove provider on disconnect

* fix: remove provider on wallet disconnection

* Revert "fix: remove provider on wallet disconnection"

This reverts commit 7a5fb08.
  • Loading branch information
iamacook authored Jun 9, 2022
1 parent f27d7d7 commit 4952348
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
3 changes: 2 additions & 1 deletion src/components/AppLayout/Header/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import {
userAccountSelector,
userEnsSelector,
} from 'src/logic/wallets/store/selectors'
import onboard, { loadLastUsedProvider } from 'src/logic/wallets/onboard'
import onboard, { loadLastUsedProvider, removeLastUsedProvider } from 'src/logic/wallets/onboard'
import { isSupportedWallet } from 'src/logic/wallets/utils/walletList'
import { initPairing, isPairingSupported } from 'src/logic/wallets/pairing/utils'
import { wrapInSuspense } from 'src/utils/wrapInSuspense'
Expand Down Expand Up @@ -52,6 +52,7 @@ const HeaderComponent = (): React.ReactElement => {

const onDisconnect = () => {
onboard().walletReset()
removeLastUsedProvider()
}

const getProviderInfoBased = () => {
Expand Down
3 changes: 1 addition & 2 deletions src/logic/wallets/store/middleware/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import { trackEvent } from 'src/utils/googleTagManager'
import { WALLET_EVENTS } from 'src/utils/events/wallet'
import { instantiateSafeContracts } from 'src/logic/contracts/safeContracts'
import { resetWeb3, setWeb3 } from 'src/logic/wallets/getWeb3'
import onboard, { removeLastUsedProvider, saveLastUsedProvider } from 'src/logic/wallets/onboard'
import onboard, { saveLastUsedProvider } from 'src/logic/wallets/onboard'
import { checksumAddress } from 'src/utils/checksumAddress'
import { shouldSwitchNetwork } from 'src/logic/wallets/utils/network'

Expand Down Expand Up @@ -41,7 +41,6 @@ const providerMiddleware =
// No wallet is connected via onboard, reset provider
if (!name && !account && !network) {
resetWeb3()
removeLastUsedProvider()
}

// Wallet 'partially' connected: only a subset of onboard subscription(s) have fired
Expand Down

0 comments on commit 4952348

Please sign in to comment.