load pinned on wspace change

pull/5272/head
aniket-engg 1 month ago committed by Aniket
parent 68cf65a72a
commit e42d25dbb3
  1. 7
      libs/remix-ui/run-tab/src/lib/actions/events.ts

@ -45,6 +45,9 @@ export const setupEvents = (plugin: RunTab) => {
} }
setFinalContext(plugin, dispatch) setFinalContext(plugin, dispatch)
fillAccountsList(plugin, dispatch) fillAccountsList(plugin, dispatch)
// 'contextChanged' is triggered on workspace change
// Load pinned contracts for updated workspace
if (context.startsWith('vm')) await loadPinnedContracts(plugin, dispatch, context)
}) })
plugin.blockchain.event.register('networkStatus', async ({ error, network }) => { plugin.blockchain.event.register('networkStatus', async ({ error, network }) => {
@ -62,9 +65,9 @@ export const setupEvents = (plugin: RunTab) => {
setPinnedChainId(dispatch, pinnedChainId) setPinnedChainId(dispatch, pinnedChainId)
// Check if provider is changed or network is changed for same provider e.g; Metamask // Check if provider is changed or network is changed for same provider e.g; Metamask
if (currentNetwork.provider !== networkProvider() || (!isVM && currentNetwork.chainId !== network.id)) { if (!isVM && (currentNetwork.provider !== networkProvider() || currentNetwork.chainId !== network.id)) {
currentNetwork.provider = networkProvider() currentNetwork.provider = networkProvider()
if (!isVM) currentNetwork.chainId = network.id currentNetwork.chainId = network.id
await loadPinnedContracts(plugin, dispatch, pinnedChainId) await loadPinnedContracts(plugin, dispatch, pinnedChainId)
} }
}) })

Loading…
Cancel
Save