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

prevent recreating directories after deleting a file in a deleted directory
pull/1359/head^2
bunsenstraat 3 years ago committed by GitHub
commit b9f7385888
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 19
      libs/remix-ui/file-explorer/src/lib/reducers/fileSystem.ts

@ -266,15 +266,16 @@ 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]
files = _.set(files, _path, {
isDirectory: true,
path,
name: extractNameFromKey(path).indexOf('gist-') === 0 ? extractNameFromKey(path).split('-')[1] : extractNameFromKey(path),
type: extractNameFromKey(path).indexOf('gist-') === 0 ? 'gist' : 'folder',
child: prevFiles ? prevFiles.child : {}
})
if (prevFiles) {
prevFiles.child && prevFiles.child[pathName] && delete prevFiles.child[pathName]
files = _.set(files, _path, {
isDirectory: true,
path,
name: extractNameFromKey(path).indexOf('gist-') === 0 ? extractNameFromKey(path).split('-')[1] : extractNameFromKey(path),
type: extractNameFromKey(path).indexOf('gist-') === 0 ? 'gist' : 'folder',
child: prevFiles ? prevFiles.child : {}
})
}
return files
}

Loading…
Cancel
Save