Merge pull request #1360 from ethereum/bunsenstraat-patch-1-1

prevent recreating directories after deleting a file in a deleted directory
pull/5370/head
bunsenstraat 3 years ago committed by GitHub
commit 3189fbb1c8
  1. 5
      libs/remix-ui/file-explorer/src/lib/reducers/fileSystem.ts

@ -266,8 +266,8 @@ const removePath = (root, path: string, pathName, files) => {
return Array.isArray(cur) ? [...acc, ...cur] : [...acc, cur]
}, [])
const prevFiles = _.get(files, _path)
prevFiles && prevFiles.child && prevFiles.child[pathName] && delete prevFiles.child[pathName]
if (prevFiles) {
prevFiles.child && prevFiles.child[pathName] && delete prevFiles.child[pathName]
files = _.set(files, _path, {
isDirectory: true,
path,
@ -275,6 +275,7 @@ const removePath = (root, path: string, pathName, files) => {
type: extractNameFromKey(path).indexOf('gist-') === 0 ? 'gist' : 'folder',
child: prevFiles ? prevFiles.child : {}
})
}
return files
}

Loading…
Cancel
Save