fix: hover flicker on queue rows during active uploads

Virtual scrolling (>200 rows) now uses in-place DOM updates when the
visible range hasn't changed, preserving :hover state instead of
rebuilding innerHTML on every progress tick.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
Administrator 2026-03-12 05:12:39 +01:00
parent d53eea443e
commit cd3493e52c

View File

@ -811,8 +811,7 @@ function renderQueueTable() {
_lastVisibleRange = { start: -1, end: -1 };
}
} else {
// Virtual scrolling for large queues — force re-render
_lastVisibleRange = { start: -1, end: -1 };
// Virtual scrolling for large queues — in-place update when range unchanged
_renderVirtualRows(tbody);
}
@ -847,8 +846,18 @@ function _renderVirtualRows(tbody) {
const startIdx = Math.max(0, Math.floor(scrollTop / VIRTUAL_ROW_HEIGHT) - VIRTUAL_OVERSCAN);
const endIdx = Math.min(totalRows, Math.ceil((scrollTop + viewportHeight) / VIRTUAL_ROW_HEIGHT) + VIRTUAL_OVERSCAN);
// Only re-render if visible range changed
if (startIdx === _lastVisibleRange.start && endIdx === _lastVisibleRange.end) return;
// Same range — try in-place update to avoid hover flicker
if (startIdx === _lastVisibleRange.start && endIdx === _lastVisibleRange.end) {
const rows = tbody.querySelectorAll('.queue-row');
if (rows.length === endIdx - startIdx) {
for (let i = 0; i < rows.length; i++) {
const job = _sortedJobsCache[startIdx + i];
if (rows[i].dataset.jobId !== job.id) { break; } // identity mismatch, full rebuild below
_updateRowInPlace(rows[i], job);
}
return;
}
}
_lastVisibleRange = { start: startIdx, end: endIdx };
const topPad = startIdx * VIRTUAL_ROW_HEIGHT;