From 05f79e1c8888d2138f99b8266b099ba6bf8eb087 Mon Sep 17 00:00:00 2001 From: ioedeveloper Date: Mon, 1 Nov 2021 14:04:59 +0100 Subject: [PATCH] Fixed boken UI for workspace named 'test', pass directory name for fileManager refresh. --- apps/remix-ide/src/app/files/fileManager.js | 2 +- apps/remix-ide/src/app/files/workspaceFileProvider.js | 8 +++++++- libs/remix-ui/workspace/src/lib/reducers/workspace.ts | 3 ++- 3 files changed, 10 insertions(+), 3 deletions(-) diff --git a/apps/remix-ide/src/app/files/fileManager.js b/apps/remix-ide/src/app/files/fileManager.js index 07fe178c5e..3d918bf940 100644 --- a/apps/remix-ide/src/app/files/fileManager.js +++ b/apps/remix-ide/src/app/files/fileManager.js @@ -140,7 +140,7 @@ class FileManager extends Plugin { refresh () { const provider = this.fileProviderOf('/') // emit rootFolderChanged so that File Explorer reloads the file tree - provider.event.emit('rootFolderChanged') + provider.event.emit('rootFolderChanged', provider.workspace || '/') } /** diff --git a/apps/remix-ide/src/app/files/workspaceFileProvider.js b/apps/remix-ide/src/app/files/workspaceFileProvider.js index 5e59ff4855..3f8f9bf0ce 100644 --- a/apps/remix-ide/src/app/files/workspaceFileProvider.js +++ b/apps/remix-ide/src/app/files/workspaceFileProvider.js @@ -33,7 +33,13 @@ class WorkspaceFileProvider extends FileProvider { removePrefix (path) { path = path.replace(/^\/|\/$/g, '') // remove first and last slash if (path.startsWith(this.workspacesPath + '/' + this.workspace)) return path - if (path.startsWith(this.workspace)) return path.replace(this.workspace, this.workspacesPath + '/' + this.workspace) + const splitPath = path.split('/') + + if (splitPath[0] === this.workspace) { + splitPath[0] = this.workspacesPath + '/' + this.workspace + path = splitPath.join('/') + return path + } path = super.removePrefix(path) let ret = this.workspacesPath + '/' + this.workspace + '/' + (path === '/' ? '' : path) diff --git a/libs/remix-ui/workspace/src/lib/reducers/workspace.ts b/libs/remix-ui/workspace/src/lib/reducers/workspace.ts index ab960dcbad..b92d7b041e 100644 --- a/libs/remix-ui/workspace/src/lib/reducers/workspace.ts +++ b/libs/remix-ui/workspace/src/lib/reducers/workspace.ts @@ -231,7 +231,8 @@ export const browserReducer = (state = browserInitialState, action: Action) => { files: state.mode === 'localhost' ? fetchWorkspaceDirectoryContent(state, payload) : state.localhost.files, isRequestingWorkspace: false, isSuccessfulWorkspace: true, - error: null + error: null, + sharedFolder: null } } }