Skip to content

Commit 9fc61bb

Browse files
Merge pull request #278 from community-scripts/fix/253
Fix: Include 'New' scripts in Download All Filtered when no filters are active
2 parents c868b00 + 75d52c7 commit 9fc61bb

File tree

1 file changed

+24
-1
lines changed

1 file changed

+24
-1
lines changed

src/app/_components/ScriptsGrid.tsx

Lines changed: 24 additions & 1 deletion
Original file line numberDiff line numberDiff 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
}

0 commit comments

Comments
 (0)