Skip to content

Commit

Permalink
add useEffect to handle disconnection condition
Browse files Browse the repository at this point in the history
  • Loading branch information
joeizang committed Jan 10, 2025
1 parent e88f778 commit 89971a1
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions libs/remix-ui/run-tab/src/lib/run-tab.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -235,6 +235,16 @@ export function RunTabUI(props: RunTabProps) {
}
}, [runTab.popup])

useEffect(() => {
if (runTab.selectExEnv.includes('injected') &&
Object.entries(runTab.accounts.loadedAccounts).length === 0 &&
runTab.accounts.selectedAccount.length > 0) {
// switch to vm-cancum because no account is loaded from injected provider
const context = plugin.blockchain.defaultPinnedProviders[0] // vm-cancun
setExecutionEnvironment({ context, fork: '' })
}
}, [runTab.accounts.loadedAccounts])

const setCheckIpfs = (value: boolean) => {
dispatch(setIpfsCheckedState(value))
}
Expand Down

0 comments on commit 89971a1

Please sign in to comment.