setSelectedContract when file changes

pull/2956/head
yann300 2 years ago
parent 6fb563f051
commit 1f7bd9e259
  1. 9
      libs/remix-ui/run-tab/src/lib/components/contractDropdownUI.tsx

@ -99,6 +99,15 @@ export function ContractDropdownUI (props: ContractDropdownProps) {
initSelectedContract()
}, [contractList])
useEffect(() => {
// if the file change the ui is already feed with another bunch of contracts.
// we also need to update the state
const contracts = contractList[currentFile]
if (contracts && contracts.length > 0) {
props.setSelectedContract(contracts[0].alias)
}
}, [currentFile])
const initSelectedContract = () => {
const contracts = contractList[currentFile]

Loading…
Cancel
Save