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. 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] return Array.isArray(cur) ? [...acc, ...cur] : [...acc, cur]
}, []) }, [])
const prevFiles = _.get(files, _path) const prevFiles = _.get(files, _path)
if (prevFiles) {
prevFiles && prevFiles.child && prevFiles.child[pathName] && delete prevFiles.child[pathName] prevFiles.child && prevFiles.child[pathName] && delete prevFiles.child[pathName]
files = _.set(files, _path, { files = _.set(files, _path, {
isDirectory: true, isDirectory: true,
path, path,
name: extractNameFromKey(path).indexOf('gist-') === 0 ? extractNameFromKey(path).split('-')[1] : extractNameFromKey(path), name: extractNameFromKey(path).indexOf('gist-') === 0 ? extractNameFromKey(path).split('-')[1] : extractNameFromKey(path),
type: extractNameFromKey(path).indexOf('gist-') === 0 ? 'gist' : 'folder', type: extractNameFromKey(path).indexOf('gist-') === 0 ? 'gist' : 'folder',
child: prevFiles ? prevFiles.child : {} child: prevFiles ? prevFiles.child : {}
}) })
}
return files return files
} }

Loading…
Cancel
Save