diff --git a/src/components/pages/gallery/Upload.tsx b/src/components/pages/gallery/Upload.tsx index 159ca3ac9..78135012f 100644 --- a/src/components/pages/gallery/Upload.tsx +++ b/src/components/pages/gallery/Upload.tsx @@ -225,7 +225,7 @@ export default function Upload(props: Props) { return collectionWiseFiles; } - const uploadFilesToExistingCollection = async (collection) => { + const uploadFilesToExistingCollection = async (collection: Collection) => { try { uploadInit(); const filesWithCollectionToUpload: FileWithCollection[] = @@ -234,7 +234,7 @@ export default function Upload(props: Props) { localID: index, collectionID: collection.id, })); - await uploadFiles(filesWithCollectionToUpload); + await uploadFiles(filesWithCollectionToUpload, [collection]); } catch (e) { logError(e, 'Failed to upload files to existing collections'); } @@ -295,7 +295,7 @@ export default function Upload(props: Props) { const uploadFiles = async ( filesWithCollectionToUpload: FileWithCollection[], - collections?: Collection[] + collections: Collection[] ) => { try { props.setUploadInProgress(true); diff --git a/src/services/upload/uploadManager.ts b/src/services/upload/uploadManager.ts index ff03b88be..308ee74a4 100644 --- a/src/services/upload/uploadManager.ts +++ b/src/services/upload/uploadManager.ts @@ -1,5 +1,4 @@ import { getLocalFiles, setLocalFiles } from '../fileService'; -import { getLocalCollections } from '../collectionService'; import { SetFiles } from 'types/gallery'; import { getDedicatedCryptoWorker } from 'utils/crypto'; import { @@ -59,7 +58,7 @@ class UploadManager { this.setFiles = setFiles; } - private async init(newCollections?: Collection[]) { + private async init(collections: Collection[]) { this.filesToBeUploaded = []; this.failedFiles = []; this.parsedMetadataJSONMap = new Map(); @@ -71,10 +70,6 @@ class UploadManager { this.existingFilesCollectionWise = sortFilesIntoCollections( this.existingFiles ); - const collections = await getLocalCollections(); - if (newCollections) { - collections.push(...newCollections); - } this.collections = new Map( collections.map((collection) => [collection.id, collection]) );