From f923786cf4c7d88cdc0dcb0d5d0995741f39e1b6 Mon Sep 17 00:00:00 2001 From: gopienkonikita Date: Wed, 27 Oct 2021 19:55:21 +0300 Subject: [PATCH] Web: Files: fixed upload --- .../Client/src/store/UploadDataStore.js | 29 ++++++++++++++----- 1 file changed, 22 insertions(+), 7 deletions(-) diff --git a/products/ASC.Files/Client/src/store/UploadDataStore.js b/products/ASC.Files/Client/src/store/UploadDataStore.js index 560c74deaa..b90ca90b16 100644 --- a/products/ASC.Files/Client/src/store/UploadDataStore.js +++ b/products/ASC.Files/Client/src/store/UploadDataStore.js @@ -318,7 +318,8 @@ class UploadDataStore { file.inConversion = false; } }); - this.refreshFiles(toFolderId, false); + + //this.refreshFiles(toFolderId, false); break; } @@ -336,7 +337,7 @@ class UploadDataStore { } }); - this.refreshFiles(toFolderId, false); + this.refreshFiles(toFolderId, false, file); const percent = this.getConversationPercent(index + 1); this.setConversionPercent(percent, !!error); } @@ -456,21 +457,35 @@ class UploadDataStore { this.selectedFolderStore.id === folderId && window.location.pathname.indexOf("/history") === -1 ) { - const { files, setFiles, folders, setFolders, filter } = this.filesStore; + const { + files, + setFiles, + folders, + setFolders, + filter, + setFilter, + } = this.filesStore; const addNewFile = () => { if (folderInfo) { - newFolders.push(folderInfo); + folderInfo && newFolders.unshift(folderInfo); setFolders(newFolders); } else { - newFiles.push(currentFile.fileInfo); + currentFile && + currentFile.fileInfo && + newFiles.unshift(currentFile.fileInfo); setFiles(newFiles); } + + const newFilter = filter; + newFilter.total = newFilter.total += 1; }; const newFiles = files; const newFolders = folders; + if (!currentFile && !folderInfo) return; + if (filter.total >= filter.pageCount) { if (files.length) { newFiles.pop(); @@ -489,9 +504,9 @@ class UploadDataStore { } }; - throttleRefreshFiles = throttle((toFolderId, currentFile, folderInfo) => { + throttleRefreshFiles = (toFolderId, currentFile, folderInfo) => { return this.refreshFiles(toFolderId, true, currentFile, folderInfo); - }, 1000); + }; uploadFileChunks = async ( location,