From fee196f739a01525d7fd75f9f1e117c4fff5edfc Mon Sep 17 00:00:00 2001 From: Joseph Izang Date: Thu, 16 Nov 2023 15:36:14 +0300 Subject: [PATCH] fix bug where compiled artifacts are not cleared before another compile completes --- apps/vyper/src/app/app.tsx | 5 +++++ apps/vyper/src/app/components/CompilerButton.tsx | 5 +++-- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/apps/vyper/src/app/app.tsx b/apps/vyper/src/app/app.tsx index 343c1ea98b..c4e738b98b 100644 --- a/apps/vyper/src/app/app.tsx +++ b/apps/vyper/src/app/app.tsx @@ -65,6 +65,10 @@ const App: React.FC = () => { return state.environment === 'remote' ? 'https://vyper2.remixproject.org/' : state.localUrl } + function resetCompilerResultState() { + setOutput({}) + } + return (
@@ -97,6 +101,7 @@ const App: React.FC = () => { compilerUrl={compilerUrl()} contract={contract} setOutput={(name, update) => setOutput({...output, [name]: update})} + resetCompilerState={resetCompilerResultState} /> diff --git a/apps/vyper/src/app/components/CompilerButton.tsx b/apps/vyper/src/app/components/CompilerButton.tsx index 90ebda1a05..39432263c7 100644 --- a/apps/vyper/src/app/components/CompilerButton.tsx +++ b/apps/vyper/src/app/components/CompilerButton.tsx @@ -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 } @@ -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