Keep data-subject-deleted cards in grid until next scan
Apply the keep-until-next-scan behaviour to deleteSubjectItems: mark the deleted items _deleted (using deleted_ids from the response) and keep them greyed in the grid instead of filtering them out. Also fixes a latent bug where renderGrid() was called with no argument and threw on files.forEach, which the surrounding try/catch swallowed as a false "Delete failed" after a successful erasure. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
1 parent
386831c423
commit
95f1f39a1f
2 files changed
+8
-5
No files matched your search
@@ -399,10 +399,13 @@ async function deleteSubjectItems() {
|
||||
document.getElementById("dsubDeleteBtn").style.display = "none";
|
||||
document.getElementById("dsubResults").innerHTML = "";
|
||||
_dsubItems = [];
|
||||
// Refresh grid
|
||||
S.flaggedData = S.flaggedData.filter(f => !ids.includes(f.id));
|
||||
S.filteredData = S.filteredData.filter(f => !ids.includes(f.id));
|
||||
renderGrid();
|
||||
// Keep the deleted items in the grid (marked, greyed, buttons hidden)
|
||||
// until the next scan run — only those the server actually deleted.
|
||||
const deletedSet = new Set(d.deleted_ids || ids);
|
||||
const _mark = (x) => { if (deletedSet.has(x.id)) x._deleted = true; };
|
||||
S.flaggedData.forEach(_mark);
|
||||
S.filteredData.forEach(_mark);
|
||||
renderGrid(S.filteredData.length ? S.filteredData : S.flaggedData);
|
||||
updateStats();
|
||||
} catch(e) {
|
||||
statusEl.textContent = "Delete failed: " + e.message;
|
||||
|
||||
Reference in new issue
Block a user