fix bug where compiled artifacts are not cleared before another compile completes

pull/4182/head
Joseph Izang 1 year ago
parent 218b69709d
commit 67be320f98
  1. 5
      apps/vyper/src/app/app.tsx
  2. 5
      apps/vyper/src/app/components/CompilerButton.tsx

@ -65,6 +65,10 @@ const App: React.FC = () => {
return state.environment === 'remote' ? 'https://vyper2.remixproject.org/' : state.localUrl
}
function resetCompilerResultState() {
setOutput({})
}
return (
<main id="vyper-plugin">
<header>
@ -97,6 +101,7 @@ const App: React.FC = () => {
compilerUrl={compilerUrl()}
contract={contract}
setOutput={(name, update) => setOutput({...output, [name]: update})}
resetCompilerState={resetCompilerResultState}
/>
</div>

@ -8,9 +8,10 @@ interface Props {
compilerUrl: string
contract?: string
setOutput: (name: string, output: any) => void
resetCompilerState: () => void
}
function CompilerButton({contract, setOutput, compilerUrl}: Props) {
function CompilerButton({contract, setOutput, compilerUrl, resetCompilerState}: Props) {
if (!contract || !contract) {
return <Button disabled>No contract selected</Button>
}
@ -21,6 +22,7 @@ function CompilerButton({contract, setOutput, compilerUrl}: Props) {
/** Compile a Contract */
async function compileContract() {
resetCompilerState()
try {
await remixClient.discardHighlight()
let _contract: any
@ -46,7 +48,6 @@ function CompilerButton({contract, setOutput, compilerUrl}: Props) {
const t: any = toStandardOutput(contract, output)
const temp = _.merge(t['contracts'][contract])
const normal = normalizeContractPath(contract)[2]
console.log(normal)
const abi = temp[normal]['abi']
const evm = _.merge(temp[normal]['evm'])
const dpb = evm.deployedBytecode

Loading…
Cancel
Save