Web: Files: fixed tree folders update

This commit is contained in:
Nikita Gopienko 2020-04-28 13:46:02 +03:00
parent 4a31b4a53c
commit 40525b2734
2 changed files with 2 additions and 4 deletions

View File

@ -87,11 +87,12 @@ class SectionBodyContent extends React.PureComponent {
if (fileAction.type === FileAction.Create || fileAction.type === FileAction.Rename) {
onLoading(true);
fetchFiles(folderId, filter, store.dispatch).then(data => {
const newItem = item.id === -1 ? null : item;
if (!item.fileExst) {
const path = data.selectedFolder.pathParts;
const newTreeFolders = treeFolders;
const folders = data.selectedFolder.folders;
loopTreeFolders(path, newTreeFolders, folders, null, item);
loopTreeFolders(path, newTreeFolders, folders, null, newItem);
setTreeFolders(newTreeFolders);
}
}).finally(() => onLoading(false))

View File

@ -204,9 +204,6 @@ const addTreeFolder = (folders, newItems, foldersCount) => {
}
export const loopTreeFolders = (path, item, folders, foldersCount, currentFolder) => {
if (currentFolder && currentFolder.id === -1) {
return;
}
const newPath = path;
while (path.length !== 0) {
const newItems = item.find((x) => x.id === path[0]);