diff --git a/src/components/pages/gallery/CollectionSelector.tsx b/src/components/pages/gallery/CollectionSelector.tsx index 82bb62ecc..ad39e3782 100644 --- a/src/components/pages/gallery/CollectionSelector.tsx +++ b/src/components/pages/gallery/CollectionSelector.tsx @@ -50,7 +50,7 @@ function CollectionSelector({ CollectionAndItsLatestFile[] >([]); useEffect(() => { - if (!attributes) { + if (!attributes || !props.show) { return; } const user: User = getData(LS_KEYS.USER); diff --git a/src/components/pages/gallery/Upload.tsx b/src/components/pages/gallery/Upload.tsx index ac0379797..11a2e41ee 100644 --- a/src/components/pages/gallery/Upload.tsx +++ b/src/components/pages/gallery/Upload.tsx @@ -141,7 +141,7 @@ export default function Upload(props: Props) { } } return { - suggestedCollectionName: commonPathPrefix, + suggestedCollectionName: commonPathPrefix || null, multipleFolders: firstFileFolder !== lastFileFolder, }; } @@ -279,14 +279,14 @@ export default function Upload(props: Props) { collectionName ); } else { - showCollectionCreateModal(analysisResult); + showCollectionCreateModal(); } }; - const showCollectionCreateModal = (analysisResult: AnalysisResult) => { + const showCollectionCreateModal = () => { props.setCollectionNamerAttributes({ title: constants.CREATE_COLLECTION, buttonText: constants.CREATE, - autoFilledName: analysisResult?.suggestedCollectionName, + autoFilledName: null, callback: uploadToSingleNewCollection, }); }; @@ -296,7 +296,10 @@ export default function Upload(props: Props) { isFirstUpload: boolean ) => { if (isFirstUpload) { - uploadToSingleNewCollection(FIRST_ALBUM_NAME); + const collectionName = + analysisResult.suggestedCollectionName ?? FIRST_ALBUM_NAME; + + uploadToSingleNewCollection(collectionName); } else { let showNextModal = () => {}; if (analysisResult.multipleFolders) {