From 2105c21a74882bdc1488bcb193f75e1aa54d5293 Mon Sep 17 00:00:00 2001 From: yann300 Date: Wed, 6 Apr 2022 15:08:45 +0200 Subject: [PATCH] fix running compileAndrun --- apps/remix-ide/src/app/tabs/compile-and-run.ts | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/apps/remix-ide/src/app/tabs/compile-and-run.ts b/apps/remix-ide/src/app/tabs/compile-and-run.ts index 0c31ed2fa8..7affa13d27 100644 --- a/apps/remix-ide/src/app/tabs/compile-and-run.ts +++ b/apps/remix-ide/src/app/tabs/compile-and-run.ts @@ -59,17 +59,19 @@ export class CompileAndRun extends Plugin { window.document.addEventListener('keydown', this.executionListener) this.on('compilerMetadata', 'artefactsUpdated', async (fileName, contract) => { - if (this.targetFileName === contract.file && contract.object && contract.object.devdoc['custom:dev-run-script']) { - this.targetFileName = null - const file = contract.object.devdoc['custom:dev-run-script'] - if (file) { - this.runScript(file, true) - _paq.push(['trackEvent', 'ScriptExecutor', 'run_script_after_compile']) + if (this.targetFileName === contract.file) { + if (contract.object && contract.object.devdoc['custom:dev-run-script']) { + this.targetFileName = null + const file = contract.object.devdoc['custom:dev-run-script'] + if (file) { + this.runScript(file, true) + _paq.push(['trackEvent', 'ScriptExecutor', 'run_script_after_compile']) + } else { + this.call('notification', 'toast', 'You have not set a script to run. Set it with @custom:dev-run-script NatSpec tag.') + } } else { this.call('notification', 'toast', 'You have not set a script to run. Set it with @custom:dev-run-script NatSpec tag.') } - } else { - this.call('notification', 'toast', 'You have not set a script to run. Set it with @custom:dev-run-script NatSpec tag.') } }) }