From e16b73c9baffa7f294cc30b984fd3467866ea990 Mon Sep 17 00:00:00 2001 From: filip mertens Date: Fri, 28 May 2021 11:47:52 +0200 Subject: [PATCH 1/3] fixes for deactivating hardhat --- apps/remix-ide/src/app/files/remixd-handle.js | 1 - apps/remix-ide/src/remixAppManager.js | 2 ++ 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/apps/remix-ide/src/app/files/remixd-handle.js b/apps/remix-ide/src/app/files/remixd-handle.js index 679a27ce9a..24b9d390ad 100644 --- a/apps/remix-ide/src/app/files/remixd-handle.js +++ b/apps/remix-ide/src/app/files/remixd-handle.js @@ -53,7 +53,6 @@ export class RemixdHandle extends WebsocketPlugin { async canceled () { // await this.appManager.deactivatePlugin('git') // plugin call doesn't work.. see issue https://github.com/ethereum/remix-plugin/issues/342 await this.appManager.deactivatePlugin('remixd') - await this.appManager.deactivatePlugin('hardhat') } /** diff --git a/apps/remix-ide/src/remixAppManager.js b/apps/remix-ide/src/remixAppManager.js index a483143ba3..e60457ad4f 100644 --- a/apps/remix-ide/src/remixAppManager.js +++ b/apps/remix-ide/src/remixAppManager.js @@ -53,6 +53,8 @@ export class RemixAppManager extends PluginManager { } async deactivatePlugin (name) { + const isActive = await this.isActive(name) + if (!isActive) return const [to, from] = [ await this.getProfile(name), await this.getProfile(this.requestFrom) From 139baae532f56cedb2772232dcdfd0b17c7b9dda Mon Sep 17 00:00:00 2001 From: aniket-engg Date: Mon, 31 May 2021 10:41:20 +0530 Subject: [PATCH 2/3] check if hardhat is active before deactivating --- apps/remix-ide/src/app/files/remixd-handle.js | 2 +- apps/remix-ide/src/remixAppManager.js | 2 -- 2 files changed, 1 insertion(+), 3 deletions(-) diff --git a/apps/remix-ide/src/app/files/remixd-handle.js b/apps/remix-ide/src/app/files/remixd-handle.js index 24b9d390ad..5708cd5d7b 100644 --- a/apps/remix-ide/src/app/files/remixd-handle.js +++ b/apps/remix-ide/src/app/files/remixd-handle.js @@ -40,7 +40,7 @@ export class RemixdHandle extends WebsocketPlugin { deactivate () { if (super.socket) super.deactivate() // this.appManager.deactivatePlugin('git') // plugin call doesn't work.. see issue https://github.com/ethereum/remix-plugin/issues/342 - this.appManager.deactivatePlugin('hardhat') + if (this.appManager.actives.includes('hardhat')) this.appManager.deactivatePlugin('hardhat') this.locahostProvider.close((error) => { if (error) console.log(error) }) diff --git a/apps/remix-ide/src/remixAppManager.js b/apps/remix-ide/src/remixAppManager.js index e60457ad4f..a483143ba3 100644 --- a/apps/remix-ide/src/remixAppManager.js +++ b/apps/remix-ide/src/remixAppManager.js @@ -53,8 +53,6 @@ export class RemixAppManager extends PluginManager { } async deactivatePlugin (name) { - const isActive = await this.isActive(name) - if (!isActive) return const [to, from] = [ await this.getProfile(name), await this.getProfile(this.requestFrom) From 1e5544c8f21a1840543f4c5b1eebe3675e064012 Mon Sep 17 00:00:00 2001 From: aniket-engg Date: Mon, 31 May 2021 10:57:09 +0530 Subject: [PATCH 3/3] typpo --- apps/remix-ide/src/app/files/remixd-handle.js | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/apps/remix-ide/src/app/files/remixd-handle.js b/apps/remix-ide/src/app/files/remixd-handle.js index 5708cd5d7b..f1eb717db6 100644 --- a/apps/remix-ide/src/app/files/remixd-handle.js +++ b/apps/remix-ide/src/app/files/remixd-handle.js @@ -31,9 +31,9 @@ const profile = { } export class RemixdHandle extends WebsocketPlugin { - constructor (locahostProvider, appManager) { + constructor (localhostProvider, appManager) { super(profile) - this.locahostProvider = locahostProvider + this.localhostProvider = localhostProvider this.appManager = appManager } @@ -41,7 +41,7 @@ export class RemixdHandle extends WebsocketPlugin { if (super.socket) super.deactivate() // this.appManager.deactivatePlugin('git') // plugin call doesn't work.. see issue https://github.com/ethereum/remix-plugin/issues/342 if (this.appManager.actives.includes('hardhat')) this.appManager.deactivatePlugin('hardhat') - this.locahostProvider.close((error) => { + this.localhostProvider.close((error) => { if (error) console.log(error) }) } @@ -82,11 +82,11 @@ export class RemixdHandle extends WebsocketPlugin { this.canceled() } }, 3000) - this.locahostProvider.init(() => {}) + this.localhostProvider.init(() => {}) this.call('manager', 'activatePlugin', 'hardhat') } } - if (this.locahostProvider.isConnected()) { + if (this.localhostProvider.isConnected()) { this.deactivate() } else if (!isElectron()) { // warn the user only if he/she is in the browser context @@ -97,7 +97,7 @@ export class RemixdHandle extends WebsocketPlugin { label: 'Connect', fn: () => { try { - this.locahostProvider.preInit() + this.localhostProvider.preInit() super.activate() setTimeout(() => { if (!this.socket || (this.socket && this.socket.readyState === 3)) { // 3 means connection closed