Pin actively downloading packages to top of list
Some checks are pending
Build and Release / build (push) Waiting to run
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:
parent
daf70211ac
commit
e0eb3f0453
@ -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",
|
||||||
|
|||||||
@ -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) {
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user