diff --git a/renderer/app.js b/renderer/app.js index e5cd0fc..581c8af 100644 --- a/renderer/app.js +++ b/renderer/app.js @@ -200,13 +200,21 @@ async function init() { } // --- Tab switching --- +let _historyDirty = false; +function _isHistoryTabActive() { + const tab = document.querySelector('.tab.active'); + return !!(tab && tab.dataset.view === 'history'); +} document.querySelectorAll('.tab').forEach(tab => { tab.addEventListener('click', () => { document.querySelectorAll('.tab').forEach(t => t.classList.remove('active')); document.querySelectorAll('.view').forEach(v => v.classList.remove('active')); tab.classList.add('active'); document.getElementById(`${tab.dataset.view}-view`).classList.add('active'); - if (tab.dataset.view === 'history') loadHistory(); + if (tab.dataset.view === 'history') { + _historyDirty = false; + loadHistory(); + } }); }); @@ -1820,16 +1828,25 @@ function handleBatchDone(summary) { updateQueueActionButtons(); renderQueueTable(); renderRecentUploadsPanel(); - loadHistory(); + // History is only visible on the Verlauf tab. Mark it dirty and refresh when + // the user actually switches to it — skips an IPC + full table rebuild per + // batch-done when the user is watching the upload view. + _historyDirty = true; + if (_isHistoryTabActive()) loadHistory(); const removeOnDone = config.globalSettings && config.globalSettings.removeFromQueueOnDone; if (removeOnDone) { - const doneJobs = queueJobs.filter(j => j.status === 'done'); - for (const job of doneJobs) { - removeJobFromIndex(job); - selectedJobIds.delete(job.id); + // Single pass: build the keep-list and clean up the index for removed jobs. + const nextJobs = []; + for (const job of queueJobs) { + if (job.status === 'done') { + removeJobFromIndex(job); + selectedJobIds.delete(job.id); + } else { + nextJobs.push(job); + } } - queueJobs = queueJobs.filter(j => j.status !== 'done'); + queueJobs = nextJobs; renderQueueTable(); } @@ -3215,24 +3232,50 @@ function updateRecentSortHeaders() { let _recentListenersBound = false; +function _buildRecentRowHtml(row) { + const cls = `recent-file-row${row.isError ? ' error' : ''}${selectedRecentIds.has(row.order) ? ' selected' : ''}`; + return `