File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -212,13 +212,14 @@ const CatalogueContent = () => {
212212 ) ;
213213
214214 const handleDownloadSelected = useCallback ( async ( ) => {
215+ if ( selectedPapers . length === 0 ) {
216+ toast . error ( "No papers selected for download." ) ;
217+ return ;
218+ }
215219 const zip = new JSZip ( ) ;
216220 const uniquePapers = Array . from (
217221 new Set ( selectedPapers . map ( ( paper ) => paper . _id ) ) ,
218222 ) . map ( ( id ) => selectedPapers . find ( ( paper ) => paper . _id === id ) ) as IPaper [ ] ;
219- if ( ! uniquePapers ) {
220- toast . error ( "No papers selected for download." ) ;
221- }
222223 for ( const paper of uniquePapers ) {
223224 try {
224225 const response = await fetch ( getSecureUrl ( paper . file_url ) ) ;
@@ -419,9 +420,9 @@ const CatalogueContent = () => {
419420 </ div >
420421 </ div >
421422
422-
423+
423424 { /* Select/Deselect/Download All Buttons */ }
424-
425+
425426 < div className = "mb-8 flex w-full items-center justify-end gap-4" >
426427 < SidebarButton onClick = { handleSelectAll } >
427428 Select All
You can’t perform that action at this time.
0 commit comments