Fix hybrid extraction label flicker between Ausstehend and Warten auf Parts

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
Sucukdeluxe 2026-03-05 16:39:31 +01:00
parent 6897776460
commit 9f62c7c29c

View File

@ -6309,19 +6309,6 @@ export class DownloadManager extends EventEmitter {
} }
if (readyArchives.size === 0) { if (readyArchives.size === 0) {
logger.info(`Hybrid-Extract: pkg=${pkg.name}, keine fertigen Archive-Sets`); logger.info(`Hybrid-Extract: pkg=${pkg.name}, keine fertigen Archive-Sets`);
// Relabel completed items that are part of incomplete multi-part archives
// from "Ausstehend" to "Warten auf Parts" so the UI accurately reflects
// that extraction is waiting for remaining parts to finish downloading.
const allDone = items.every((i) => i.status === "completed" || i.status === "failed" || i.status === "cancelled");
if (!allDone) {
for (const entry of items) {
if (entry.status === "completed" && entry.fullStatus === "Entpacken - Ausstehend") {
entry.fullStatus = "Entpacken - Warten auf Parts";
entry.updatedAt = nowMs();
}
}
this.emitState();
}
return 0; return 0;
} }
@ -6402,24 +6389,26 @@ export class DownloadManager extends EventEmitter {
// Mark items based on whether their archive is actually ready for extraction. // Mark items based on whether their archive is actually ready for extraction.
// Only items whose archive is in readyArchives get "Ausstehend"; others keep // Only items whose archive is in readyArchives get "Ausstehend"; others keep
// "Warten auf Parts" to avoid flicker between hybrid runs. // their current label to avoid flicker between hybrid runs.
const allDownloaded = completedItems.length >= items.length; const allDownloaded = completedItems.length >= items.length;
let labelsChanged = false;
for (const entry of completedItems) { for (const entry of completedItems) {
if (isExtractedLabel(entry.fullStatus)) { if (isExtractedLabel(entry.fullStatus)) {
continue; continue;
} }
if (allDownloaded) { const belongsToReady = allDownloaded
// Everything downloaded — all remaining items will be extracted || hybridFileNames.has((entry.fileName || "").toLowerCase())
entry.fullStatus = "Entpacken - Ausstehend"; || (entry.targetPath && hybridFileNames.has(path.basename(entry.targetPath).toLowerCase()));
} else if (hybridFileNames.has((entry.fileName || "").toLowerCase()) || const targetLabel = belongsToReady ? "Entpacken - Ausstehend" : "Entpacken - Warten auf Parts";
(entry.targetPath && hybridFileNames.has(path.basename(entry.targetPath).toLowerCase()))) { if (entry.fullStatus !== targetLabel) {
entry.fullStatus = "Entpacken - Ausstehend"; entry.fullStatus = targetLabel;
} else { entry.updatedAt = nowMs();
entry.fullStatus = "Entpacken - Warten auf Parts"; labelsChanged = true;
} }
entry.updatedAt = nowMs();
} }
this.emitState(); if (labelsChanged) {
this.emitState();
}
try { try {
const result = await extractPackageArchives({ const result = await extractPackageArchives({