Merge pull request #1720 from ethereum/fix-workspace

Fix broken workspace UI
pull/5370/head
David Disu 3 years ago committed by GitHub
commit cd873c4f29
  1. 2
      apps/remix-ide/src/app/files/fileManager.js
  2. 8
      apps/remix-ide/src/app/files/workspaceFileProvider.js
  3. 3
      libs/remix-ui/workspace/src/lib/reducers/workspace.ts

@ -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 || '/')
}
/**

@ -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)

@ -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
}
}
}

Loading…
Cancel
Save