From 3c8aa2079c125b80bf20cf11bd96f3acee69ff92 Mon Sep 17 00:00:00 2001 From: yann300 Date: Fri, 3 May 2019 16:13:42 +0200 Subject: [PATCH] don't init at pageload but when run tab loads --- src/app.js | 3 --- src/app/tabs/run-tab.js | 30 ++++++++++++++++++++++-------- src/universal-dapp.js | 1 - 3 files changed, 22 insertions(+), 12 deletions(-) diff --git a/src/app.js b/src/app.js index d558280284..bba39f4ee1 100644 --- a/src/app.js +++ b/src/app.js @@ -129,9 +129,6 @@ class App { self._components.config = new Config(fileStorage) registry.put({api: self._components.config, name: 'config'}) - executionContext.init(self._components.config) - executionContext.listenOnLastBlock() - self._components.gistHandler = new GistHandler() self._components.filesProviders = {} diff --git a/src/app/tabs/run-tab.js b/src/app/tabs/run-tab.js index 2b7de46133..c3b588a84f 100644 --- a/src/app/tabs/run-tab.js +++ b/src/app/tabs/run-tab.js @@ -12,6 +12,8 @@ var ContractDropdownUI = require('./runTab/contractDropdown.js') var Recorder = require('./runTab/model/recorder.js') var RecorderUI = require('./runTab/recorder.js') +const executionContext = require('../../execution-context') + import { BaseApi } from 'remix-plugin' const profile = { @@ -30,13 +32,15 @@ class RunTab extends BaseApi { constructor (udapp, udappUI, config, fileManager, editor, logCallback, filePanel, pluginManager, compilersArtefacts) { super(profile) this.event = new EventManager() - - this.renderInstanceContainer() - this.renderSettings(udapp) - this.renderDropdown(udappUI, fileManager, pluginManager, compilersArtefacts, config, editor, udapp, filePanel, logCallback) - this.renderRecorder(udapp, udappUI, fileManager, config, logCallback) - this.renderRecorderCard() - this.renderContainer() + this.config = config + this.udapp = udapp + this.udappUI = udappUI + this.fileManager = fileManager + this.editor = editor + this.logCallback = logCallback + this.filePanel = filePanel + this.pluginManager = pluginManager + this.compilersArtefacts = compilersArtefacts } renderContainer () { @@ -51,6 +55,7 @@ class RunTab extends BaseApi { ` this.container.appendChild(el) + return this.container } renderInstanceContainer () { @@ -158,7 +163,16 @@ class RunTab extends BaseApi { } render () { - return this.container + executionContext.init(this.config) + executionContext.stopListenOnLastBlock() + executionContext.listenOnLastBlock() + this.udapp.resetEnvironment() + this.renderInstanceContainer() + this.renderSettings(this.udapp) + this.renderDropdown(this.udappUI, this.fileManager, this.pluginManager, this.compilersArtefacts, this.config, this.editor, this.udapp, this.filePanel, this.logCallback) + this.renderRecorder(this.udapp, this.udappUI, this.fileManager, this.config, this.logCallback) + this.renderRecorderCard() + return this.renderContainer() } } diff --git a/src/universal-dapp.js b/src/universal-dapp.js index 621d11e8fd..10de36ce9b 100644 --- a/src/universal-dapp.js +++ b/src/universal-dapp.js @@ -38,7 +38,6 @@ module.exports = class UniversalDApp extends UdappApi { } this.txRunner = new TxRunner({}, this._txRunnerAPI) this.accounts = {} - this.resetEnvironment() executionContext.event.register('contextChanged', this.resetEnvironment.bind(this)) }