Pin actively downloading packages to top of list
Some checks are pending
Build and Release / build (push) Waiting to run

Packages with items in downloading/validating/extracting/integrity_check
state are always shown at the top regardless of sort order (A-Z or Z-A).

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
Sucukdeluxe 2026-03-02 12:50:14 +01:00
parent daf70211ac
commit e0eb3f0453
2 changed files with 24 additions and 2 deletions

View File

@ -1,6 +1,6 @@
{ {
"name": "real-debrid-downloader", "name": "real-debrid-downloader",
"version": "1.4.83", "version": "1.4.84",
"description": "Real-Debrid Downloader Desktop (Electron + React + TypeScript)", "description": "Real-Debrid Downloader Desktop (Electron + React + TypeScript)",
"main": "build/main/main/main.js", "main": "build/main/main/main.js",
"author": "Sucukdeluxe", "author": "Sucukdeluxe",

View File

@ -667,7 +667,29 @@ export function App(): ReactElement {
const hiddenPackageCount = shouldLimitPackageRendering const hiddenPackageCount = shouldLimitPackageRendering
? Math.max(0, totalPackageCount - packages.length) ? Math.max(0, totalPackageCount - packages.length)
: 0; : 0;
const visiblePackages = packages; const visiblePackages = useMemo(() => {
if (!snapshot.session.running || packages.length <= 1) {
return packages;
}
const activeStatuses = new Set(["downloading", "validating", "integrity_check", "extracting"]);
const active: PackageEntry[] = [];
const rest: PackageEntry[] = [];
for (const pkg of packages) {
const hasActive = pkg.itemIds.some((id) => {
const item = snapshot.session.items[id];
return item && activeStatuses.has(item.status);
});
if (hasActive) {
active.push(pkg);
} else {
rest.push(pkg);
}
}
if (active.length === 0 || active.length === packages.length) {
return packages;
}
return [...active, ...rest];
}, [packages, snapshot.session.running, snapshot.session.items]);
useEffect(() => { useEffect(() => {
if (!snapshot.session.running) { if (!snapshot.session.running) {