diff --git a/apps/remix-ide-e2e/src/tests/workspace.test.ts b/apps/remix-ide-e2e/src/tests/workspace.test.ts index 15b435c890..3235b8594e 100644 --- a/apps/remix-ide-e2e/src/tests/workspace.test.ts +++ b/apps/remix-ide-e2e/src/tests/workspace.test.ts @@ -47,7 +47,7 @@ module.exports = { .execute(function () { document.querySelector('*[data-id="modalDialogCustomPromptTextCreate"]')['value'] = 'workspace_name_1' }) .click('*[data-id="workspacesModalDialogModalDialogModalFooter-react"] .modal-ok') .waitForElementVisible('*[data-id="treeViewLitreeViewItemtests"]') - .waitForElementNotPresent('*[data-id="treeViewLitreeViewItemtest.sol"]') + .waitForElementNotPresent('*[data-id="treeViewLitreeViewItemtest.sol"]', 60000) .click('*[data-id="workspacesSelect"] option[value="workspace_name"]') .waitForElementVisible('*[data-id="treeViewLitreeViewItemtests"]') }, diff --git a/libs/remix-ui/workspace/src/lib/remix-ui-workspace.tsx b/libs/remix-ui/workspace/src/lib/remix-ui-workspace.tsx index 95cb36597d..00c7254b38 100644 --- a/libs/remix-ui/workspace/src/lib/remix-ui-workspace.tsx +++ b/libs/remix-ui/workspace/src/lib/remix-ui-workspace.tsx @@ -119,6 +119,7 @@ export const Workspace = (props: WorkspaceProps) => { const createNewWorkspace = async (workspaceName) => { try { + await props.fileManager.closeAllFiles() await props.createWorkspace(workspaceName) await setWorkspace(workspaceName) toast('New default workspace has been created.') @@ -127,6 +128,7 @@ export const Workspace = (props: WorkspaceProps) => { console.error(e) } } + const [state, setState] = useState({ workspaces: [], reset: false, @@ -224,6 +226,7 @@ export const Workspace = (props: WorkspaceProps) => { const workspaceName = workspaceCreateInput.current.value try { + await props.fileManager.closeAllFiles() await props.createWorkspace(workspaceName) await setWorkspace(workspaceName) } catch (e) {