Fix: Include 'New' scripts in Download All Filtered when no filters are active
- Modified handleDownloadAllFiltered to combine filteredScripts and newestScripts when no filters are active - Ensures all scripts including those in the 'Newest Scripts' carousel are downloaded - Maintains existing behavior when filters are active - Fixes issue where 'New' scripts were excluded from downloads
This commit is contained in:
@@ -535,7 +535,30 @@ export function ScriptsGrid({ onInstallScript }: ScriptsGridProps) {
|
|||||||
};
|
};
|
||||||
|
|
||||||
const handleDownloadAllFiltered = () => {
|
const handleDownloadAllFiltered = () => {
|
||||||
const slugsToDownload = filteredScripts.map(script => script.slug).filter(Boolean);
|
|
||||||
|
let scriptsToDownload: ScriptCardType[] = filteredScripts;
|
||||||
|
|
||||||
|
if (!hasActiveFilters) {
|
||||||
|
|
||||||
|
const scriptMap = new Map<string, ScriptCardType>();
|
||||||
|
|
||||||
|
filteredScripts.forEach(script => {
|
||||||
|
if (script?.slug) {
|
||||||
|
scriptMap.set(script.slug, script);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
|
newestScripts.forEach(script => {
|
||||||
|
if (script?.slug && !scriptMap.has(script.slug)) {
|
||||||
|
scriptMap.set(script.slug, script);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
scriptsToDownload = Array.from(scriptMap.values());
|
||||||
|
}
|
||||||
|
|
||||||
|
const slugsToDownload = scriptsToDownload.map(script => script.slug).filter(Boolean);
|
||||||
if (slugsToDownload.length > 0) {
|
if (slugsToDownload.length > 0) {
|
||||||
void downloadScriptsIndividually(slugsToDownload);
|
void downloadScriptsIndividually(slugsToDownload);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user