From 4a13b36e4841c387d74c3bced0e60ce092ff1472 Mon Sep 17 00:00:00 2001 From: lianahus Date: Mon, 5 Jun 2023 10:11:34 +0200 Subject: [PATCH] fixed switch to workspace --- .../src/lib/components/homeTabFile.tsx | 20 +++++++++---------- 1 file changed, 9 insertions(+), 11 deletions(-) diff --git a/libs/remix-ui/home-tab/src/lib/components/homeTabFile.tsx b/libs/remix-ui/home-tab/src/lib/components/homeTabFile.tsx index 55d8223886..3c42debe4e 100644 --- a/libs/remix-ui/home-tab/src/lib/components/homeTabFile.tsx +++ b/libs/remix-ui/home-tab/src/lib/components/homeTabFile.tsx @@ -119,22 +119,20 @@ function HomeTabFile({plugin}: HomeTabFileProps) { const workspaces = await plugin.call('filePanel', 'getWorkspaces') if (!workspaces.find(workspace => workspace.name === wName)) { await plugin.call('filePanel', 'createWorkspace', wName, 'remixDefault') - await plugin.call('filePanel', 'setWorkspace', wName) - } else { - await plugin.call('filePanel', 'switchToWorkspace', { name: wName, isLocalHost: false }) } + await plugin.call('filePanel', 'switchToWorkspace', { name: wName, isLocalHost: false }) + await plugin.call('filePanel', 'switchToWorkspace', { name: wName, isLocalHost: false }) // don't ask why - const content = `// SPDX-License-Identifier: MIT -pragma solidity >=0.7.0 <0.9.0; + const content = ` + // SPDX-License-Identifier: MIT + pragma solidity >=0.7.0 <0.9.0; -contract helloWorld { -} -` - - const {newContent, newPath} = await plugin.call('fileManager', 'writeFileNoRewrite', '/contracts/helloWorld.sol', content) + contract helloWorld { + } + ` + const {newPath} = await plugin.call('fileManager', 'writeFileNoRewrite', '/contracts/helloWorld.sol', content) await plugin.call('fileManager', 'open', newPath) } - const uploadFile = async (target) => { _paq.push(['trackEvent', 'hometab', 'filesSection', 'uploadFile']) await plugin.call('filePanel', 'uploadFile', target)