From 5f354bb5fcf2b27433fbc99fc16749ad814e5154 Mon Sep 17 00:00:00 2001 From: kamaji Date: Sat, 7 Feb 2026 21:02:06 -0600 Subject: [PATCH] Fix queue list crash: empty-state element destroyed by innerHTML loadQueue() used getElementById('empty-state') on each call, but the first successful render wiped it with innerHTML=''. Every subsequent call got null and threw TypeError on .style access, silently killing all future list refreshes. Counters kept working because updateStats() runs independently. Fix: recreate the empty state as innerHTML string instead of referencing a DOM element that gets destroyed. Co-Authored-By: Claude Opus 4.6 --- app/templates/queue.html | 16 ++++++---------- 1 file changed, 6 insertions(+), 10 deletions(-) diff --git a/app/templates/queue.html b/app/templates/queue.html index 744dc59..394448f 100644 --- a/app/templates/queue.html +++ b/app/templates/queue.html @@ -401,7 +401,6 @@ Storage.init().then(() => { async function loadQueue() { const queueList = document.getElementById('queue-list'); - const emptyState = document.getElementById('empty-state'); const photos = await Storage.db.photos .where('username').equals(currentUsername) @@ -413,21 +412,18 @@ async function loadQueue() { const completedPhotos = photos.filter(p => p.status === 'verified' || p.status === 'failed'); - if (photos.length === 0) { - emptyState.style.display = 'block'; - queueList.innerHTML = ''; - queueList.appendChild(emptyState); - document.getElementById('sync-now-btn').disabled = true; - return; - } - - emptyState.style.display = 'none'; // Revoke old ObjectURLs before rebuilding to prevent memory leaks queueList.querySelectorAll('img[src^="blob:"]').forEach(img => { URL.revokeObjectURL(img.src); }); queueList.innerHTML = ''; + if (photos.length === 0) { + queueList.innerHTML = '

No photos in queue

'; + document.getElementById('sync-now-btn').disabled = true; + return; + } + // Show active uploads first (newest first) for (const photo of activePhotos.reverse()) { queueList.appendChild(createQueueItem(photo, false));