Fix: Prevent duplicate history card removal on UI update

This commit is contained in:
Simon Cordt
2025-09-25 12:02:38 +02:00
parent 7131297170
commit 20ad903aa0
2 changed files with 3 additions and 0 deletions
+1
View File
@@ -313,6 +313,7 @@
const dir = (state.historyPaging?.params?.sort_dir === 'asc') ? 'asc' : 'desc';
if (grid && sentinel && list.length) {
UI.withStableAnchor(() => {
try { Array.from(grid.querySelectorAll('.pqueue-empty')).forEach((n) => n.remove()); } catch (err) { /* noop */ }
for (const row of list) {
const id = row?.id;
if (id == null || state.historyIds.has(id)) continue;
+2
View File
@@ -639,6 +639,7 @@
if (!grid || !sentinel) return;
const dir = (state.historyPaging?.params?.sort_dir === 'asc') ? 'asc' : 'desc';
UI.withStableAnchor(() => {
try { Array.from(grid.querySelectorAll('.pqueue-empty')).forEach((n) => n.remove()); } catch (err) { /* noop */ }
const existingIds = new Set(Array.from(grid.querySelectorAll('.pqueue-history-card')).map((n) => n.getAttribute('data-id')));
const ordered = Array.isArray(state.history) ? state.history.slice() : [];
try {
@@ -800,6 +801,7 @@
} catch (err) { /* noop */ }
if (!state.historyIds) state.historyIds = new Set();
UI.withStableAnchor(() => {
try { Array.from(grid.querySelectorAll('.pqueue-empty')).forEach((n) => n.remove()); } catch (err) { /* noop */ }
for (const row of list) {
const id = row?.id;
if (id == null || state.historyIds.has(id)) continue;