diff --git a/apps/remix-ide/src/app/plugins/config.ts b/apps/remix-ide/src/app/plugins/config.ts index 61f7cdd41f..3d4ce015e4 100644 --- a/apps/remix-ide/src/app/plugins/config.ts +++ b/apps/remix-ide/src/app/plugins/config.ts @@ -21,10 +21,12 @@ export class ConfigPlugin extends Plugin { const param = params[name] ? params[name] : config.get(name) if (param === 'true') return true if (param === 'false') return false + console.log(param) return param } setAppParameter (name: string, value: any) { + console.log('setAppParameter', name, value) const config = Registry.getInstance().get('config').api config.set(name, value) } diff --git a/apps/remix-ide/src/app/tabs/compile-tab.js b/apps/remix-ide/src/app/tabs/compile-tab.js index 2c447d49b3..f409129bb1 100644 --- a/apps/remix-ide/src/app/tabs/compile-tab.js +++ b/apps/remix-ide/src/app/tabs/compile-tab.js @@ -144,12 +144,12 @@ class CompileTab extends CompilerApiMixin(ViewPlugin) { // implements ICompilerA this.queryParams.update(params) } - getAppParameter (name) { - return this.call('config', 'getAppParameter', name) + async getAppParameter (name) { + return await this.call('config', 'getAppParameter', name) } - setAppParameter (name, value) { - this.call('config', 'setAppParameter', name, value) + async setAppParameter (name, value) { + await this.call('config', 'setAppParameter', name, value) } } diff --git a/apps/solidity-compiler/src/app/compiler-api.ts b/apps/solidity-compiler/src/app/compiler-api.ts index 0a456ab6a4..2e81d08ba1 100644 --- a/apps/solidity-compiler/src/app/compiler-api.ts +++ b/apps/solidity-compiler/src/app/compiler-api.ts @@ -291,11 +291,11 @@ export const CompilerApiMixin = (Base) => class extends Base { this.on('themeModule', 'themeChanged', this.data.eventHandlers.onThemeChanged) // Run the compiler instead of trying to save the website - this.data.eventHandlers.onKeyDown = (e) => { + this.data.eventHandlers.onKeyDown = async (e) => { // ctrl+s or command+s if ((e.metaKey || e.ctrlKey) && e.keyCode === 83 && this.currentFile !== '') { e.preventDefault() - this.compileTabLogic.runCompiler(this.getAppParameter('hardhat-compilation')) + this.compileTabLogic.runCompiler(await this.getAppParameter('hardhat-compilation')) } } window.document.addEventListener('keydown', this.data.eventHandlers.onKeyDown) diff --git a/libs/remix-ui/solidity-compiler/src/lib/compiler-container.tsx b/libs/remix-ui/solidity-compiler/src/lib/compiler-container.tsx index 2636c9d77c..eabccbd8a8 100644 --- a/libs/remix-ui/solidity-compiler/src/lib/compiler-container.tsx +++ b/libs/remix-ui/solidity-compiler/src/lib/compiler-container.tsx @@ -64,23 +64,29 @@ export const CompilerContainer = (props: CompilerContainerProps) => { }, []) useEffect(() => { - if (compileTabLogic && compileTabLogic.compiler) { - setState(prevState => { - const params = api.getCompilerParameters() - const optimize = params.optimize - const runs = params.runs as string - const evmVersion = params.evmVersion - return { - ...prevState, - hideWarnings: api.getAppParameter('hideWarnings') as boolean || false, - autoCompile: api.getAppParameter('autoCompile') as boolean || false, - includeNightlies: api.getAppParameter('includeNightlies') as boolean || false, - optimize: optimize, - runs: runs, - evmVersion: (evmVersion !== null) && (evmVersion !== 'null') && (evmVersion !== undefined) && (evmVersion !== 'undefined') ? evmVersion : 'default' - } - }) - } + (async () => { + if (compileTabLogic && compileTabLogic.compiler) { + const autocompile = await api.getAppParameter('autoCompile') as boolean || false + const hideWarnings = await api.getAppParameter('hideWarnings') as boolean || false + const includeNightlies = await api.getAppParameter('includeNightlies') as boolean || false + setState(prevState => { + const params = api.getCompilerParameters() + const optimize = params.optimize + const runs = params.runs as string + const evmVersion = params.evmVersion + + return { + ...prevState, + hideWarnings: hideWarnings, + autoCompile: autocompile, + includeNightlies: includeNightlies, + optimize: optimize, + runs: runs, + evmVersion: (evmVersion !== null) && (evmVersion !== 'null') && (evmVersion !== undefined) && (evmVersion !== 'undefined') ? evmVersion : 'default' + } + }) + } + })() }, [compileTabLogic]) useEffect(() => {