Compare commits
2 Commits
5afb56b987
...
e49f5493fe
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
e49f5493fe | ||
|
|
58a21ed321 |
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "multi-hoster-uploader",
|
||||
"version": "3.2.2",
|
||||
"version": "3.2.3",
|
||||
"description": "Upload files to doodstream, voe, vidmoly, byse simultaneously",
|
||||
"main": "main.js",
|
||||
"scripts": {
|
||||
|
||||
@ -1141,7 +1141,14 @@ const _collatorSimple = new Intl.Collator('de');
|
||||
// Dynamic keys (status/speed/progress) AND size (which goes 0 → actual when
|
||||
// previews resolve / upload starts) are recomputed each call — otherwise a
|
||||
// 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']);
|
||||
|
||||
function sortQueueJobs(jobs) {
|
||||
@ -1149,7 +1156,9 @@ function sortQueueJobs(jobs) {
|
||||
const factor = direction === 'asc' ? 1 : -1;
|
||||
const canCache = _STATIC_SORT_KEYS.has(key);
|
||||
const sig = canCache ? `${key}|${direction}|${jobs.length}` : '';
|
||||
if (sig && _queueSortCache.sig === sig) return _queueSortCache.result;
|
||||
if (sig && _queueSortCache.sig === sig && _queueSortCache.jobsRef === jobs) {
|
||||
return _queueSortCache.result;
|
||||
}
|
||||
|
||||
const sorted = jobs.slice().sort((a, b) => {
|
||||
let cmp = 0;
|
||||
@ -1161,7 +1170,7 @@ function sortQueueJobs(jobs) {
|
||||
else if (key === 'progress') cmp = (a.progress || 0) - (b.progress || 0);
|
||||
return cmp * factor;
|
||||
});
|
||||
if (sig) _queueSortCache = { sig, result: sorted };
|
||||
if (sig) _queueSortCache = { sig, result: sorted, jobsRef: jobs };
|
||||
return sorted;
|
||||
}
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user