[ACS-6583] fix flickering toolbar on folder upload (#3609)

This commit is contained in:
Mykyta Maliarchuk
2024-01-26 11:06:27 +01:00
committed by GitHub
parent f628892cf3
commit c9dc3ce5ca
2 changed files with 13 additions and 1 deletions

View File

@@ -227,6 +227,18 @@ describe('FilesComponent', () => {
expect(component.reload).toHaveBeenCalled();
}));
it('should not call reload on fileUploadComplete event if file parent folder already displayed', fakeAsync(() => {
spyOn(component.documentList.data, 'getRows').and.returnValue([{ node: { entry: { isFolder: true, name: 'files' } } }] as any);
const file: any = { file: { options: { parentId: 'parentId', path: '/files' } } };
component.node = { id: 'parentId' } as any;
uploadService.fileUploadComplete.next(file);
tick(500);
expect(component.reload).not.toHaveBeenCalled();
}));
it('should not call refresh on fileUploadComplete event if parent mismatch', fakeAsync(() => {
const file: any = { file: { options: { parentId: 'otherId' } } };
component.node = { id: 'parentId' } as any;

View File

@@ -257,7 +257,7 @@ export class FilesComponent extends PageComponent implements OnInit, OnDestroy {
}
displayFolderParent(index: number, filePath = '') {
const parentName = filePath.split('/')[index];
const parentName = filePath.split('/').filter((el) => el)[index];
const currentFoldersDisplayed = (this.documentList.data.getRows() as ShareDataRow[]) || [];
const alreadyDisplayedParentFolder = currentFoldersDisplayed.find((row) => row.node.entry.isFolder && row.node.entry.name === parentName);