File tree Expand file tree Collapse file tree 1 file changed +24
-1
lines changed Expand file tree Collapse file tree 1 file changed +24
-1
lines changed Original file line number Diff line number Diff line change @@ -535,7 +535,30 @@ export function ScriptsGrid({ onInstallScript }: ScriptsGridProps) {
535535 } ;
536536
537537 const handleDownloadAllFiltered = ( ) => {
538- const slugsToDownload = filteredScripts . map ( script => script . slug ) . filter ( Boolean ) ;
538+
539+ let scriptsToDownload : ScriptCardType [ ] = filteredScripts ;
540+
541+ if ( ! hasActiveFilters ) {
542+
543+ const scriptMap = new Map < string , ScriptCardType > ( ) ;
544+
545+ filteredScripts . forEach ( script => {
546+ if ( script ?. slug ) {
547+ scriptMap . set ( script . slug , script ) ;
548+ }
549+ } ) ;
550+
551+
552+ newestScripts . forEach ( script => {
553+ if ( script ?. slug && ! scriptMap . has ( script . slug ) ) {
554+ scriptMap . set ( script . slug , script ) ;
555+ }
556+ } ) ;
557+
558+ scriptsToDownload = Array . from ( scriptMap . values ( ) ) ;
559+ }
560+
561+ const slugsToDownload = scriptsToDownload . map ( script => script . slug ) . filter ( Boolean ) ;
539562 if ( slugsToDownload . length > 0 ) {
540563 void downloadScriptsIndividually ( slugsToDownload ) ;
541564 }
You can’t perform that action at this time.
0 commit comments