Compare commits

..

No commits in common. "e49f5493fe5fa6478b99673791185793b0e169e3" and "5afb56b987f9e224745b8611d8a10738466a6a57" have entirely different histories.

2 changed files with 4 additions and 13 deletions

View File

@ -1,6 +1,6 @@
{ {
"name": "multi-hoster-uploader", "name": "multi-hoster-uploader",
"version": "3.2.3", "version": "3.2.2",
"description": "Upload files to doodstream, voe, vidmoly, byse simultaneously", "description": "Upload files to doodstream, voe, vidmoly, byse simultaneously",
"main": "main.js", "main": "main.js",
"scripts": { "scripts": {

View File

@ -1141,14 +1141,7 @@ const _collatorSimple = new Intl.Collator('de');
// Dynamic keys (status/speed/progress) AND size (which goes 0 → actual when // Dynamic keys (status/speed/progress) AND size (which goes 0 → actual when
// previews resolve / upload starts) are recomputed each call — otherwise a // previews resolve / upload starts) are recomputed each call — otherwise a
// queue sorted by size during previews would be stuck in all-zeros order. // queue sorted by size during previews would be stuck in all-zeros order.
// let _queueSortCache = { sig: '', result: [] };
// CRITICAL: the cache also tracks jobsRef (identity of the queueJobs array) so
// that a full replacement (e.g. backup import, queue restore) invalidates the
// cache. Length alone can match across a replace and would otherwise pin the
// renderer to stale job references — the UI freezes showing old statuses even
// though queueJobs itself has fresh objects. Observed as "upload runs in
// status bar but all rows stay 'Bereit'" after importing a backup.
let _queueSortCache = { sig: '', result: [], jobsRef: null };
const _STATIC_SORT_KEYS = new Set(['filename', 'host']); const _STATIC_SORT_KEYS = new Set(['filename', 'host']);
function sortQueueJobs(jobs) { function sortQueueJobs(jobs) {
@ -1156,9 +1149,7 @@ function sortQueueJobs(jobs) {
const factor = direction === 'asc' ? 1 : -1; const factor = direction === 'asc' ? 1 : -1;
const canCache = _STATIC_SORT_KEYS.has(key); const canCache = _STATIC_SORT_KEYS.has(key);
const sig = canCache ? `${key}|${direction}|${jobs.length}` : ''; const sig = canCache ? `${key}|${direction}|${jobs.length}` : '';
if (sig && _queueSortCache.sig === sig && _queueSortCache.jobsRef === jobs) { if (sig && _queueSortCache.sig === sig) return _queueSortCache.result;
return _queueSortCache.result;
}
const sorted = jobs.slice().sort((a, b) => { const sorted = jobs.slice().sort((a, b) => {
let cmp = 0; let cmp = 0;
@ -1170,7 +1161,7 @@ function sortQueueJobs(jobs) {
else if (key === 'progress') cmp = (a.progress || 0) - (b.progress || 0); else if (key === 'progress') cmp = (a.progress || 0) - (b.progress || 0);
return cmp * factor; return cmp * factor;
}); });
if (sig) _queueSortCache = { sig, result: sorted, jobsRef: jobs }; if (sig) _queueSortCache = { sig, result: sorted };
return sorted; return sorted;
} }